Curve fitting a complex function using cftool
10 views (last 30 days)
Show older comments
I'm using the cftool toolbox to find fits for a complex valued transfer function. The toolbox clearly can't handle a complex numbers, so I have separated the data into its real and imaginary components and I now have two curve fits.
By way of background, my data is an Accelerance Frequency Response Function obtained from an impact hammer test of a structure and ought to look something like this:
H = (-w^2) / (k-(w^2)m+iwc)
where w is frequency in rad/s, k is stiffness, m is mass and c is damping.
My question is this: is there a simple way that the cftool can find the best fit for both data sets without giving me two separate values for mass, stiffness and damping? Put another way, is it possible to force the coefficients from two curve fits to be co-dependant and thereby find the best fit for the complex valued data?
0 Comments
Accepted Answer
Matt J
on 31 Jan 2013
I don't think so, but LSQCURVEFIT can fit vector-valued functions, if you've got it.
More Answers (2)
Craig Cowled
on 3 May 2013
4 Comments
Matt J
on 24 May 2013
Edited: Matt J
on 24 May 2013
y1 = abs(window'.*y)
I'm sure you'll be skeptical, since you've already reached results that you like. However, the above part isn't the best idea because the use of ABS() makes your residuals non-differentiable in regions where window'.*y are close to zero. The algorithms used by LSQNONLIN, however, assume differentiability. One way to avoid this is to use abs().^2 instead.
However, it's probably even better just to split up into real/imaginary parts as Zhang proposed. This really doesn't involve code any more complicated than what you're doing now. There is no real advantage trying to avoid it:
delt = window' .* (y-z);
deltaH = [real(delt(:)); imag(delt(:))];
That's it. Only simple changes to your last 2 lines of code required.
Finally, note that this same technique could have been applied in LSQCURVEFIT as well, and with the same ease.
Craig Cowled
on 25 May 2013
1 Comment
Matt J
on 25 May 2013
Edited: Matt J
on 25 May 2013
The 7% difference is interesting, though. You might experiment by trying to solve with simulated data where you know the ground truth k,m,c. Then you can know which approach is really more accurate. Similar to what you say in (1), my intuition is also that the real/imag approach should do better, since it uses a larger number of directly observable data.
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!