Programmatically calculate goodness of fit using Curve Fitting Toolbox?

1 view (last 30 days)
Hi,
I am hoping to retrieve the goodness of fit values that the curve fit tool calculates for a custom model, but programatically. My model is:
g=fittype('a*sin(2*pi*25000000*x+b)+c')
which I fit to x and y data with:
f=fit(x,v,g)
(where v is for voltage). This returns the following:
f =
General model:
f(x) = a*sin(2*pi*25000000*x+b)+c
Coefficients (with 95% confidence bounds):
a = -13.03 (-13.04, -13.02)
b = -4.746 (-4.747, -4.745)
c = -0.3985 (-0.4073, -0.3897)
From here I want to see the sum of squares due to error (SSE), R-square, Adjusted R-square, and Root Mean Square Error (RMSE), as a quantitative assessment of the model quality. Does anyone have any solutions? There is no obvious way of retrieving this information listed in the documentation for the toolbox.
Thanks in advance.

Accepted Answer

Matt J
Matt J on 8 Feb 2014
The FIT command returns goodness of fit info as its second output argument, as documented here

More Answers (0)

Community Treasure Hunt

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

Start Hunting!