[SciPy-user] Curve fitting and LaTeX output

Warren Weckesser warren.weckesser@gmail....
Thu Aug 28 10:22:53 CDT 2008

Hi David,

On Thu, Aug 28, 2008 at 8:56 AM, David Lonie <loniedavid@gmail.com> wrote:

> Thanks for the fast reply! I plugged in my data to that script and
> added some output, but I get an invalid fit out of it. The fit I got
> from oocalc is approx
> y = 32 - 0.85^x, and fmin is returning
> y = 12 - 0.65^x, which for some reason returns an array of non-numbers
> when I try to generate plot data?

If c[0]=12 and c[1]=-0.65, then your function is not 12-0.65**x,
but rather 12 + (-0.65)**x, which is not defined when x is not
an integer.   As Ryan suggested, try a better starting guess.
You know the function must be decreasing, so c[1] must be
between 0 and 1.  If I use c_initial_guess = [10, 0.5], I get
c_final =  [12.20289742   0.65819867]
This is still a bad fit; I think this sum is not a good model for
your data.  You'll get a better fit with a simple scaled
exponential:  c[0]*(c[1]**x)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080828/75f4e946/attachment.html 

More information about the SciPy-user mailing list