Re: Help fitting Exponential curves
- To: mathgroup at smc.vnet.net
- Subject: [mg29006] Re: [mg28969] Help fitting Exponential curves
- From: "Mark Harder" <harderm at ucs.orst.edu>
- Date: Thu, 24 May 2001 04:07:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Todd,
You haven't formatted the Fit command properly to solve the
log-linearized problem. First, unless x values are {1,2,3,... }, Peak must
be a list of x,y pairs (see the online Help for Fit[]). Hence,
Log[Peak]=Log[{{x1,y1},{x2,y2},....} ] won't work. You need to format your
data as peak={{x1,Log[y1]},{x2,Log[y2]},....}. Next, Fit is a linear
fitting routine in that it finds the coefficients for the linear combination
of defined functions that best fits your data, in the least-squares sense.
Parameter K of your fit is the coefficient weighting the function -t. The
other coefficient is Log[Po], which weights the constant function 1. In
other words, y=Log[Po] -K*t. BTW, Mathematica expects that symbols
beginning with upper case letters are internal functions or symbols; its
better style to use lower case (peak).
Try the following form of solution for data set peak formatted as above:
Clear[x];
solution=Fit[peak,{1,-x},x]
Also, since you want to define a function to do the fitting for some
variables, you need to consider whether you want to use = or := to do that.
I don't know what you meant to do with the function you were trying to
define, so I will just refer you to the documentation for this point.
-mark harder
-----Original Message-----
From: Todd <tcs3a at virginia.edu>
To: mathgroup at smc.vnet.net
Subject: [mg29006] [mg28969] Help fitting Exponential curves
>Hello,
> I am looking to fit some exponential curves to a form of
> P=Po*e^(-K*t) where K and Po are values I need. The P and t I have.
> I'm working with mathematica 4.1 and I can read the data and plot it fine
>but it doesn't want to give me reasonable fits.
> So I guess my question is how would you go about getting the Fitting to
>work on fitting a Pre-Exponential and an exponential variable. If I type
>
> PeakFit[x_] = Fit[Peak, Exp[-x], x]
>
>it only gives me a Pre-exponential, however if I type.
>
> PeakFit[x_] = Fit[Log[Peak], {-x,Log[x]}, x]
>
>It just doesn't like that. Could Someone Please point me in the right
>direction.
>
>
>Thank you,
>
>Todd
>
>