comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL - EXP fitting function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL - EXP fitting function [message #65897 is a reply to message #65896] Fri, 27 March 2009 06:38 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Mar 27, 8:27 am, Paolo <pgri...@gmail.com> wrote:
> Vince Hradil wrote:
>> On Mar 26, 5:55 pm, Christopher Thom <ct...@oddjob.uchicago.edu>
>> wrote:
>>> Quoth glen_a...@hotmail.com:
>
>>>> On Mar 26, 5:12 pm, David Fanning <n...@dfanning.com> wrote:
>>>> > glen_a...@hotmail.com writes:
>>>> > > Greetings everyone! My first post! I have some data x, y, that i would
>>>> > > like to fit to a fitting function of the kind yfit = EXP(a+ b*x).
>>>> > > where a and b are constants which i would like found. Any ideas on how
>>>> > > to do this?
>
>>>> > ab = LinFit(x, y)
>>>> > a = ab[0]
>>>> > b = ab[1]
>
>>>> > Cheers,
>
>>>> > David
>>>> > --
>>>> > David Fanning, Ph.D.
>>>> > Fanning Software Consulting, Inc.
>>>> > Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> > Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>>>> Thanks for getting back to me David,
>
>>>> Does the linfit function work when i would like my data to be fitted to
>>>> an EXP(a + bx) function? I didn't think that a linear function would be
>>>> correct when considering the EXP? Or am i getting confused going from
>>>> real space to log space!
>
>>> No, linfit() fits a linear model of the form y = A + B*x, so it will not
>>> "just work". why don't you just fit a linear model in logspace?
>
>>> res = linfit(x, alog(yfit))
>>> a = res[0]
>>> b = res[1]
>
>>> cheers
>>> chris
>
>> I'll second that.  This is really a linear problem, so no need to
>> solve the non-linear equation.
>
> I disagree. If you have negative measurements, or positive
> but very small measurements, you will get bad results.
> Also the result will not be the least-squares best fit.
>
> Ciao,
> Paolo

It can still be fit as a linear system - just weight the residuals by
the measured values, like this: http://mathworld.wolfram.com/LeastSquaresFittingExponential. html
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL & ENVI error: WIDGET_CONTROL: Invalid widget identifier: 17
Next Topic: Re: IDL & ENVI error: WIDGET_CONTROL: Invalid widget identifier: 17

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 18:32:37 PDT 2025

Total time taken to generate the page: 0.16127 seconds