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

1 view (last 30 days)
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 Comments
Matt J
Matt J on 15 Mar 2019
Edited: Matt J on 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.

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!