Curve Fitting app makes it easy to plot and analyze fits at the command line. You can export individual fits to the workspace for further analysis, or you can generate MATLAB® code to recreate all fits and plots in your session. By generating code you can use your interactive curve fitting session to quickly assemble code for curve and surface fits and plots into useful programs.
Select File > Generate Code.
The Curve Fitting app generates code from your session and displays the file in the MATLAB Editor. The file includes all fits and plots in your current session. The file captures the following information:
Names of fits and their variables
Fit settings and options
Curve or surface fitting objects and methods used to create the fits:
A cell-array of
objects representing the fits
A structure array with goodness-of fit information.
Save the file.
For more information on working with your generated code, exporting fits to the workspace, and recreating your fits and plots at the command line, see: