| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Curve Fitting Toolbox |
| Contents | Index |
| Learn more about Curve Fitting Toolbox |
| On this page… |
|---|
Displaying Multiple Fits Simultaneously |
When you have created multiple fits you can compare different fit types and settings side by side in the Surface Fitting Tool. You can view plots simultaneously and you can examine the goodness-of-fit statistics to compare your fits. This section describes how to compare multiple fits.
To compare plots and see multiple fits simultaneously, use the layout controls at the top right of the Surface Fitting Tool. Alternatively, you can click Window on the menu bar to select the number and position of tiles you want to display. The following example shows two fit tabs displayed side by side. You can see three fits in the session listed in the Table of Fits.

You can close fit tab displays (with the Close button, Fit menu, or context menu), but they remain in your session. The Table of Fits displays all your fits (open and closed). Double-click a fit in the Table of Fits to open a fit tab display. To remove a fit, see Deleting a Surface Fit
You can dock and undock individual fits and navigate between them using the standard MATLAB Desktop and Window menus in the Surface Fitting Tool. For more information, see Opening and Arranging Desktop Tools in the MATLAB Desktop Tools and Development Environment documentation.
Within each fit tab, you can display up to three plots simultaneously to examine the fit. Use the View menu to select the type of plot to display: surface plot, residuals plot, or contour plot. See also Exploring and Customizing Plots.

The surface plot displays by default. For polynomial and custom fits, you also can use the Tools menu to display Surface Prediction Bounds. When you display Surface Prediction Bounds, two additional surfaces are plotted to show the prediction bounds on both sides of your model fit.
Choose which bounds to display: None, 90%, 95%, 99%, or Custom. The custom option opens a dialog box where you can enter the required confidence level.
The following example shows prediction bounds. You can see three surfaces on the plot. The top and bottom surfaces show the prediction bounds at the specified confidence level on either side of your model fit surface.

You can also switch your surface plot to a 2-D plot if desired. Your plot cursor must be in rotation mode. Select Tools > Rotate 3D if necessary. Then, right-click the plot to select X-Y, X-Z, or Y-Z view, or to select Rotate Options. All these context menu options are standard MATLAB 3–D plot tools. See Rotate 3D — Interactive Rotation of 3-D Views in the MATLAB Graphics documentation.
On the Residuals Plot, you can view the errors between your fitted surface and your data, and you can remove outliers. See Removing Outliers. The following example shows a residuals plot with some excluded outliers.

Use the contour plot to examine a contour map of your surface. A contour plot makes it easier to see points that have the same height. An example is shown in Displaying Surface, Residual, and Contour Plots.
The Table of Fits list pane shows all fits in the current session.

After using graphical methods to evaluate the goodness of fit, you can examine the goodness-of-fit statistics shown in the table to compare your fits. The goodness-of-fit statistics help you determine how well the surface fits the data. Click the table column headers to sort by statistics, name, fit type, and so on.
The following guidelines help you use the statistics to determine the best fit:
SSE is the sum of squares due to error of the fit. A value closer to zero indicates a fit that is more useful for prediction.
R-square is the square of the correlation between the response values and the predicted response values. A value closer to 1 indicates that a greater proportion of variance is accounted for by the model.
DFE is the degree of freedom in the error.
Adj R-sq is the degrees of freedom adjusted R-square. A value closer to 1 indicates a better fit.
RMSE is the root mean squared error or standard error. A value closer to 0 indicates a fit that is more useful for prediction.
# Coeff is the number of coefficients in the model. When you have several fits with similar goodness-of-fit statistics, look for the smallest number of coefficients to help decide which fit is best. You must trade off the number of coefficients against the goodness of fit indicated by the statistics to avoid overfitting.
For a more detailed explanation of the Curve Fitting Toolbox statistics, see Goodness-of-Fit Statistics.
To compare the statistics for different surfaces and decide which fit is the best tradeoff between over- and under-fitting, use a similar process to that described for curve fitting in Determining the Best Fit.
![]() | Fitting Multiple Surfaces | Generating M-Files and Exporting Fits to the Workspace | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |