A problem with curve fitting using cftool

7 views (last 30 days)
Ammar
Ammar on 30 Jul 2014
Commented: dpb on 31 Jul 2014
I am using the curve fitting tool to find the parameters of an equation. The equation is sort of complicated and has 5 parameters:
y = f(w) = (((C1.*(-R1-R2).*w - C2.*R2.*w).^2 + (1 - C1.*C2.*R1.*R2.*w.^2).^2).^(1/2))./(w.*((-C2.*C3.*R2.*w + C1.*(-C2.*R1.*w - C3.*(R1 + R2).*w)).^2 + (-C2 - C3 + C1.*(-1 + C2.*C3.*R1.*R2.*w.^2)).^2).^(1/2))
here's a nicer expression of the equation:
I need to fit this equation to my data points from an experiment, and then find the five parameters: C1, C2, C3, R1, R2.
All what I did was choosing "Custom Equation", choosing my data points (y and w), two and copying and pasting the equation above, and then hitting the "Fit" button. Here is the plot generated by curve fit tool:
log scale:
As you can see on the log scale, there's a big difference between the data points curve (blue) and the fitted curve (red). I cannot accept the parameters calculated by this curve fit as accurate. Is there any idea why Matlab is not doing this curve fit correctly (is the equation too complicated? I forgot to adjust some settings?). Thanks!
  3 Comments
Ammar
Ammar on 31 Jul 2014
w.mat is the data points for x-axis.
dpb
dpb on 31 Jul 2014
OK, thanks...I looked at this some. What do the data represent and where does the expression originate?
I think it impossible to generate a good fit from the expression over the entire range of the data you have. The essentially square "kink" near the origin in w just can't be represented by the functional form given. In simplification, it boils down to
[1 + k1*w^2 + k2*w^4]/{w*[1 + k3*w^2 + k4*w^4]}
if one combines the agglomeration of coefficients and combines like power terms. There is no adjustment of constants that can change the slope from vertical to horizontal over a region with that polynomial form effectively.
I was, however, able to generate a reasonable fitting equation in log(w) by
yfit=a*exp(b*log(w))
Coefficients (with 95% confidence bounds):
a = 2.085e+10 (2.02e+10, 2.151e+10)
b = -0.9717 (-0.9768, -0.9666)
Goodness of fit: R-square: 0.9993
If one evaluates this and plots on semilogx() coordinates, it looks pretty good.
I know that doesn't help in evaluating your constants but I don't think that's agonna' happen w/ your data; the model just doesn't lend itself to the data as you have it.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!