To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
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?
No products are associated with this question.
I don't think so, but LSQCURVEFIT can fit vector-valued functions, if you've got it.
I just noticed another question on the forum in which someone suggested to use mldivide. I'll have a look at this when I get some time, but has anyone else used mldivide to curve fit a complex valued transfer function?
MattJ, not sceptical ... always worthwhile to know the intrinsic quirks of an algorithm.
I used your code and compared the differences:
1) The size of the residuals vector doubled. It must be calculating residuals for the real and imaginary parts separately. Intuitively, this is bound to produce a better result.
2) The difference in results for w1 and w2 (tightly bounded) was less than 0.1%.
3) The difference in results for the other variables, however, was between 1% and 7%.
4) Both methods produced plots that closely approximated my data.
I think I'll use the code you suggested, it seems better to use a method that calculates residuals of real and imag parts separately.
Thank you for sharing.