MATLAB: How to export the residuals from the Basic Fitting Interface Window to the MATLAB workspace

basiccurvefitfittinginterfaceMATLABresidualresidualswindow

There is an option to send the norm of the residuals to the workspace from the second panel (click the arrow key on the first panel to get here), but not one for sending the residuals themselves.

Best Answer

This enhancement has been incorporated in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
As a workaround, use "Save To Workspace" on the second panel to save the fit to the workspace (say it is called fit1).
Then if the fit is one of the two spline fits, and x and y are the data vectors, use:
residuals = abs(y - ppval(fit1.coeff,x));
If the fit is one of the polynomials, use:
residuals = abs(y-polyval(fit1.coeff,x));