evaluate the error between the fitted curve and the data (NEW in fitting curve and optimization tools)

2 visualizzazioni (ultimi 30 giorni)
hello everyone!
as I mentionned, I'm new in using fitting curve and optimization tools in matlab. I have data [theta,radius], and I want to fit them to a model.
firstly, I have plotted the deviation between my nominal radius and the radius from the data (please see the plot in colors).
Then, I applied the following code for fitting my curve to a model I established, in which a and b are unknown parameters (to find the values after).
function sse = sseval1(x,theta,radius)
a = x(1);
b = x(2);
sse = sum((radius - a*(b+10).*sqrt((1-sqrt((cos(2.*theta)).^2))./((cos(theta)).^2.*(sin(theta)).^2))).^2);
in the command window I write
fun = @(x)sseval1(x,theta,radius);
x0 = rand(4,1);
bestx = fminsearch(fun,x0)
a = bestx(1);
b = bestx(2);
yfit = a*(b+10).*sqrt((1-sqrt((cos(2.*theta)).^2))./((cos(theta)).^2.*(sin(theta)).^2));
figure; plot(theta,radius,'*');
hold on
plot(theta,yfit,'r');
The problem is the plot I get: the data are far from the fitted curve (which it seems to be not normal). what I should do then?
(I have tried the fminsearch, fmincon, and fminunc functions, but they give me the same result).
if I should provide more details, I will do surely.
Another question, is how to evaluate the error of the fitting model?
hope to get your help
plot of fitted curve vs data.jpg
  2 Commenti
Matt J
Matt J il 15 Mar 2019
Modificato: Matt J il 15 Mar 2019
From your posting history, I see that you have left several answers to your questions un-accepted, even though your comments there indicate that those answers addressed your questions. To improve responsive to your posts, it is advisable to accept-click the answers which worked for you.
insaf
insaf il 17 Mar 2019
@Matt J I just forget to do it.
However, the comments on this question were removed, I don't know why?!

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by