[time-nuts] exponential+linear fit

Paul Alfille paul.alfille at gmail.com
Sat Oct 5 11:47:58 EDT 2013


Ok, here is an approach to the iterative least-squares fit:

F(t) = k1 + k2*t + k3*exp(k4*t)

L = Sum( [yi - F(ti)] ^2 )

So least square for each parameter: dL/dk = 0

The summing nomenclature is rather awkawrd in ascii, so I'll use

<T> = Sum(ti)
<T^2> = Sum(ti^2)
<E> = Sum( exp(k4*ti) )
<TE> = Sum( ti*ext(k4*ti) )
<E^2> = Sum( exp(2*k4*ti) )
etc for <Y>, <TY>, <EY>, <TEY>, <TE^2>

dL/dk1 -> N*k1 + <T>*k2 + <E>* k3 = <Y>
dL/dk2 -> <T>*k1 + <T^2>*k2 + <TE>* k3 = <TY>
dL/dk3 -> <E>*k1 + <TE>*k2 + <E^2>* k3 = <EY>
dL/dk4 -> <TE>*k1 + <T^2E>*k2 + <TE^2>* k3 = <TEY>

The only problem is that k4 is stuck in that <E> term.

I use the last 3 equations for solve for k1, k2 and k3 given the data and k4
then use Newton-Raffson's method to fin an iterative solution for k4.

E.g. Let
X=[k1,k2,k3], B=[<TY>,<EY>,<TEY>] and A=
[ <T>    <T^2>    <TE>   ]
[ <E>   <TE>      <E^2> ]
[<TE>  <T^2E> <TE^2> ]

Then solving A.X=B is easy for a given k4

Use the first equation
N*k1+<T>*k2+<E>*k3=<Y>
as
G(k4) = N*k1+<T>*k3+<E>*k3-<Y> (=0 eventually)

Newton's method needs
dG/dk4 = k3*<TE> which we already solved for!

Thus k4new = k4 - G(k4)/(k3*<TE>

Use the new k4 to calculate <E>, <E^2>, ... then new k1,k2,k3.

The advantage of this approach is that you are doing an iterative
aproximation on only one parameter, with explicit calculation of the other
parameters.


Paul Alfille


On Sat, Oct 5, 2013 at 11:18 AM, Magnus Danielson <
magnus at rubidium.dyndns.org> wrote:

> On 10/05/2013 04:48 PM, Jim Lux wrote:
> > On 10/5/13 3:57 AM, Magnus Danielson wrote:
> >> On 10/05/2013 01:03 AM, Jim Lux wrote:
> >>> On 10/4/13 2:54 PM, Alan Melia wrote:
> >>>> Jim it may not be helpful but had you thoughtof expanding the
> >>>> exponential as the first few terms of an infinite series to see if it
> >>>> simplifies fitting?
> >
> >>>
> >>> I'll try attaching a plot of some sample data.
> >> Oh, I/Q data, in that case recording the state of your tracking loop
> >> helps a lot. Also, the rate of your exponential should be fairly well
> >> known, so you could do a linear least square with that.
> >>
> >
> > It's IQ but not from a tracking loop..
> >
> > The underlying physics is a turn on transient as it comes to
> > temperature (with gain/phase variation) superimposed on a longer term
> > linear trend.
> Ah, OK.
> > And it occurs to me that fitting more polynomial terms (although one
> > can represent exp(x)+kx with a polynomial) runs the risk of removing
> > the data (the variations in the I/Q), while constraining the fit to an
> > exp(-kt) means that the "transient" starts at the beginning.
> You will reduce your degrees of freedom with the amount of polynomial
> terms you estimate and remove from the data. Your Pade approximation to
> a+kx+b*exp(c*x) of say three terms of exp will consume 5 degrees of
> freedom, but if you have thousands of samples you can live with it for
> many uses. What kind of measure do you want to extract here really?
> Noise-power?
>
> Cheers,
> Magnus
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to
> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
>


More information about the time-nuts mailing list