Re: mpfit of parametric data? [message #40281] |
Wed, 28 July 2004 22:56  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"jamiesmyth_uni@yahoo.ca" <jamiesmyth_uni@yahoo.ca> writes:
> Thanks for your reply Craig. I think I have a handle on fitting both X
> and Y but I've taken a step backward this evening. I am having a very
> difficult time fitting even one of these time series and I'm not
> entirely sure why. I've read the FAQ again...
>
> Here is a quick and dirty example of what I observe. Essentially, I am
> completely unable to fit the sine oscillation unless I start with a
> very good first guess at the parameters. In particular, I cannot seem
> to fit both the linear trend and the oscillations. Can anyone take a
> stab at why this is so?
Greetings, this is not a big surprise. As I say on the FAQ page,
choosing the initial parameters is one of the key elements in getting
a good fit. This is especially true for an oscillatory function such
as yours, which can have multiple minima. Your initial guess, P1 =
[1,1,1,1,1], is too far from the global solution, so MPFIT gets
trapped at a different local minimum.
In these types of situations, you will probably have to proceed
iteratively. For example, first removing long term trends, then
fitting periodic signals. You may have to perform a Fourier transform
to locate periodic signals and to provide a good inital estimate of
the period/frequency.
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|