goodness of fit data for a fit
7 views (last 30 days)
Show older comments
Hi,
I am new in matlab and I would be thankful if you help me.
I want to get the goodness of fit data using fit = goodnessOfFit(x,xref,cost_func) or any other command that provides statistics of goodness of fit for the following fit:
- load sample.mat;
- rangemin = 50;
- rangemax = 149;
- xprime(1)=1;
- xprime(2)=20;
- [x]=lsqcurvefit(@our,xprime,t(rangemin:rangemax),ourdata(rangemin:rangemax));
- y=our(x,t);
- x1=x(1,1)
- x2=x(1,2)
- function y=our(x,t)
- y=((0.282*x(2))-0.24)*x(1)*exp((x(2)-0.24)*t);
- end
I am not sure what should be x and xref and cost_func here and where I should put this command?
0 Comments
Answers (2)
Sulaymon Eshkabilov
on 14 Jan 2023
From your posted link, you can see that:
(1) x is:
x = lisqcurvefit(...) gives you the found fit model coefficients. E.g.: from your exercise:
- y=((0.282*x(2))-0.24)*x(1)*exp((x(2)-0.24)*t);
x = [x(1), (x2)]
(2) xref is:
xref is your measured data
(3) cost_func is:
cost_func = 'NRMSE' % normalized root mean squared error (NRMSE) as the cost function
You may also consider setting it to be:
cost_func = 'MSE'; % Mean squared error
Or
cost_func = 'NMSE'; % Normalized mean squared error
0 Comments
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!