Curve fitting a complex function using cftool
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Matt J
le 31 Jan 2013
I don't think so, but LSQCURVEFIT can fit vector-valued functions, if you've got it.
Plus de réponses (2)
Craig Cowled
le 3 Mai 2013
4 commentaires
Matt J
le 24 Mai 2013
Modifié(e) : Matt J
le 24 Mai 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
le 25 Mai 2013
1 commentaire
Matt J
le 25 Mai 2013
Modifié(e) : Matt J
le 25 Mai 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.
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!