Curve fitting a complex function using cftool
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Matt J
2013-1-31
I don't think so, but LSQCURVEFIT can fit vector-valued functions, if you've got it.
更多回答(2 个)
Craig Cowled
2013-5-3
4 个评论
Matt J
2013-5-24
编辑:Matt J
2013-5-24
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
2013-5-25
1 个评论
Matt J
2013-5-25
编辑:Matt J
2013-5-25
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!