Hi Joe that sounds like a system I was thinking of suggesting to Jim. I
wrote some iterative code on a time share bureau machine in the late60s.....
make a guess at kx values and let the prog spit out k values for a dk/dt
minimum ....then chose another set of starters an see if it finishes in the
same place. A given local minimum may not be the lowest. Its crude but very
effective. My boss didnt believe it and employed a mathematician who did not
understand the physics to get it wrong ! this was fitting to similar type
equation an Arhennius equation (if I remembered how to spell him :-))
A friendly mathematician called it the BFI technique
Alan
G3NYK
----- Original Message -----
From: "Joseph Gwinn" <[email protected]>
To: <[email protected]>
Sent: Friday, October 04, 2013 9:18 PM
Subject: Re: [time-nuts] exponential+linear fit
On Fri, 04 Oct 2013 14:30:40 -0400, [email protected] wrote:
------------------------------
Message: 4
Date: Fri, 04 Oct 2013 10:38:07 -0700
From: Jim Lux <[email protected]>
To: Discussion of precise time and frequency measurement
<[email protected]>
Subject: [time-nuts] exponential+linear fit
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I'm trying to find a good way to do a combination exponential/linear fit
(for baseline removal). It's modeling phase for a moving source plus a
thermal transient, so the underlying physics is the linear term (the
phase varies linearly with time, since the velocity is constant) plus
the temperature effect.
the general equation is y(t) = k1 + k2*t + k3*exp(k4*t)
Working in matlab/octave, but that's just the tool, I'm looking for some
numerical analysis insight.
I could do it in steps.. do a straight line to get k1 and k2, then fit
k3& k4 to the residual; or fit the exponential first, then do the
straight line., but I'm not sure that will minimize the error, or if it
matches the underlying model (a combination of a linear trend and
thermal effects) as well.
I suppose I could do something like do the fit on the derivative, which
would be
y'(t) = k2 + k3*k4*exp(k4*t)
Then solve for the the k1. In reality, I don't think I care as much
what the numbers are (particularly the k1 DC offset) so could probably
just integrate (numerically)
y'()-k2-k3*k4*exp(k4*t) and get my sequence with the DC term, linear
drift, and exponential component removed.
The fear I have is that differentiating emphasizes noise.
How many measured data points do you have? If you have enough data,
you can use the MatLab nlinfit() (nonlinear fit) function to fit the
data directly to the y(t) equation.
Because nlinfit uses a least-squares approach, and there are many
coefficients to be found, a reasonable starting point is required. The
fit on the derivative, while probably too noisy to yield a useful final
answer, would be one way to get some of the initial values.
I did just this recently, fitting a skew gaussian pdf to a histogram,
using rough mean, standard deviation, and skewness computed from the
histogram to seed nlinfit. The mean, standard deviation, and skewness
computed from the histogram are famously inaccurate if there is
significant skew, but it was still good enough to keep nlinfit from
getting lost.
Joe Gwinn
_______________________________________________
time-nuts mailing list -- [email protected]
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.
_______________________________________________
time-nuts mailing list -- [email protected]
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.