help-octave
[Top][All Lists]

## RE: pade function in Octave?

 From: Windhorn, Allen E [ACIM/LSA/MKT] Subject: RE: pade function in Octave? Date: Mon, 4 Nov 2019 20:16:10 +0000

```Vivek,

> -----Original Message-----
> From: Help-octave <help-octave-
> bounces+allen.windhorn=address@hidden> On Behalf Of vivek
> guajri

> I have attached my code file. I am trying to use the lsqlin function in
> order to keep the derivative of the fit function to be zero wherever it is
> negative.

I don't know lsqlin, so I won't be much help with the error.

I understand you want to fit a polynomial to your data, but a special
polynomial that is monotonic.  Is there a special reason that the fitted
function has to be a polynomial?  A polynomial is a BAD FUNCTION to fit
to the data, so why don't you find a function that fits better?  If the
function you are fitting CAN'T have negative derivatives, you don't have
to try to prevent them from happening.

Does the function have to be monotonic for ALL x or just x in the range of
the data?  You want a polynomial a0+a1x+a2x^2+a3x^3+...+anx^n that
minimizes the least square error, subject to the constraint that
a1+2a2x+3a3x^2+... =nanx^(n-1)>0.  Is the constraint for ALL x from
-infinity to infinity, or for all xi in the data points, or all x from x0 to
x(j-2)?
A polynomial with only even powers and only positive coefficients would
satisfy the first condition, but would it fit the data well?

Regards,
Allen
```