Home > Archive > Matlab > January 2008 > lsqcurvefit on exponentially damped sinusoids
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
lsqcurvefit on exponentially damped sinusoids
|
|
|
| Hello,
I am trying to fit exponentially damped sinusoidal transients to my
data .
I have used the prony function in Matlab to extract amplitude, damping
and frequency of the sum of exponentially damped sinusoids (have not
figured out how to get the phase yet). I then used lsqcurvefit
function to "perfect" the fit, with the initial values being from the
prony analysis
For test sums of exponentially damped sinusoids which I have defined
myself, it works correctly. However when I try actual transient data,
I do not get a good fit.
Another commercial software called Autosignal idoes least squares non-
linear regression as lsqcurvefit and is able to fit my data to sums of
exponentially damped sinusoids.
Any useful suggestions will be appreciated. I can also post my all or
a snippet of my code.
Rush
| |
|
| Use 5 term function for damped exponential sine with phase
shift factor. Will need pfc starting seed. Be sure to
include only the data that the equation would model from x
= 0 to x= large (steady state).
Should be no trouble if your data is well represented by
the data model. If not, add more terms or choose a
different function.
Another approach is to have the searcher find coefficients
to an s-plane transfer function(s) whose net step response
matches your data. Then you can add multiple functions to
study the natural response, an injected ripple, etc.
The raw data must be pretty close to a step or pulse
response, though.
| |
|
| On Jan 12, 8:47 pm, "Bill " <william.nospam.a.c...@gm.com> wrote:
> Use 5 term function for damped exponential sine with phase
> shift factor. Will need pfc starting seed. Be sure to
> include only the data that the equation would model from x
> = 0 to x= large (steady state).
>
> Should be no trouble if your data is well represented by
> the data model. If not, add more terms or choose a
> different function.
>
> Another approach is to have the searcher find coefficients
> to an s-plane transfer function(s) whose net step response
> matches your data. Then you can add multiple functions to
> study the natural response, an injected ripple, etc.
>
> The raw data must be pretty close to a step or pulse
> response, though.
Bill, did you mean a 4-term damped exponential? My damped function is
of the form: A*exp(-B*t)*sin(C*t+D).
Here's a couple lines of what I'm doing to find my initial points...
function fitting(time,signal,N)
step=t(2)-t(1);
Fs=1/step;
[b,a]=prony(y,np*2,np*2);
[r,p,k]=residuez(b,a);
poles=log(p(:))*Fs;
amp_peak=(abs(r));
damp=real(log(p)*Fs);
Phase=real(poles); %not sure this is right
freq=(imag(poles)/(2*pi));
if N==1
initial=[amp_peak(1) damp(1) freq(1) Phase(1)];
elseif N==2
.... and so on. I then use the intial values in my lsqcurvefit. Adding
more terms does not even change the fit.
Thanks for your response.
| |
|
| I add an extra A term (A1 - A2*exp(-A3*t)*sin(A4*t + A5)
for the step input response being analyzed in my own
situation.
Getting the right starting seed vector is key to getting
the perfect fit. You might try to fit some 'perfect' noise
free data in the beginning to see if your setup is viable.
If it won't fit perfect data, imperfect data won't be much
better.
There are traits for the data and the presumed system which
you can use to get good starting values. (period, steady
state, phase shift).
|
|
|
|
|