help-octave
[Top][All Lists]
Advanced

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

RE: HELP please, Can't fit data properly


From: Windhorn, Allen E [ACIM/LSA/MKT]
Subject: RE: HELP please, Can't fit data properly
Date: Thu, 4 Oct 2018 15:57:46 +0000

> -----Original Message-----
> From: Help-octave [mailto:help-octave-
> address@hidden On Behalf Of T.G.ALG
> 
> Hi, I'm trying to fit some data to a function of degree 4 or 5, but when I
> plot it, it doesn't fit:
> 
> DATA:
> C30 =
> 
>    0.063330   0.057200   0.052870   0.047380   0.044860   0.039710
> 0.037070   0.036030   0.034990
> t =
> 
>     1.0000    1.5000    2.0000    3.0000    5.0000    7.0000   10.0000
> 13.0000   18.0000

As some others have pointed out, a polynomial isn't the best curve to
fit to these data.  You should always look for a function that curves
the way the data points curve, and your function seems to be trying
to be asymptotic to the y axis on the left and some constant ~0.03 on
the right.

You should use a nonlinear least squares curve fit like leasqr to fit a
function like u*t^(v*t)+w (I was in a hurry, so used Excel).  This
gives coefficients of u = 0.04256, v = -0.3827, w = 0.0265 for a
minimax fit.  The fit was somewhat sloppy, and the v coefficient isn't
far from -0.5, so I tried fitting with that value, and got:
C30 = 0.0384/sqrt(t)+0.0263 with a pretty good fit, but the point at
t=5.0 was throwing things off.  Assuming that was an outlier, I took
it out, and got an excellent fit with C30=0.0384/sqrt(t)+0.0254, with
maximum error around 0.5%.  

Regards,
Allen



reply via email to

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