help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: pade function in Octave?


From: Windhorn, Allen E [ACIM/LSA/MKT]
Subject: RE: pade function in Octave?
Date: Fri, 1 Nov 2019 17:14:10 +0000

Vivek,

> -----Original Message-----
> From: Help-octave <help-octave-
> bounces+allen.windhorn=address@hidden> On Behalf Of vivek
> guajri
> 
> I have some data and would like to fit it to a polynomial equation. The
> polyfit function is fine, but I need something which can fit better than
> that. Maybe a combination of polyfit and lsqin will do the job!

The polyfit function fits the BEST POSSIBLE polynomial to your data, as long
as you want the "best" in a least-square sense, so it's no use trying to find
a better polynomial.  If you want "best" in a minimax sense then Chebyshev
is the way to go.  But generally most data isn't well-fit by a high-order
polynomial -- the higher the order, the more it wants to shoot off to infinity,
and real data generally don't go there.  So you probably want to fit another
type of function instead of a polynomial.
You may have been on the right track with a Pade approximant, which fits a
rational function, but apparently the Pade package is for some specialized
purpose and not suitable for function fitting.  You can use leasqr to fit any
function including rational functions.  It's in the optim package.

The data you provided had only Y values -- are the X values equally spaced?
Plotting the data, it's very "spiky" and probably hopeless to fit any kind of
reasonable function to it, certainly not a polynomial.  What are you trying
to predict?

Regards,
Allen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]