The Basic Fitting Interface Matlab Help

The Basic Fitting Interface
MATLAB supports curve fitting through the Basic Fitting interface. Using this interface, you can quickly perform basic curve fitting tasks within the same easy to- use environment. The interface is designed so that you can:
• Fit data using a cubic spline or a polynomial up to degree 10.
• Plot multiple fits simultaneously for a given data set.
• Plot the residuals.
• Examine the numerical results of a fit.
• Interpolate or extrapolate a fit.
• Annotate the plot with the numerical fit results and the norm of residuals.
• Save the fit and evaluated results to the MATLAB workspace.
Depending on your specific curve fitting application, you can use the Basic Fitting interface, the command line functions, or both. Note: you can use the Basic Fitting interface only with two-dimensional data. However, if you plot multiple data sets as a subplot, and at least one data set is two-dimensional, then the interface is

Two panes of the Basic Fitting interface are shown in Figure 5.7-1. To reproduce this. state:

  1.  Plot some data.
  2. Select Basic Fitting from the Tools menu.
  3. Click the right arrow button once
The Basic Fitting interface.

The Basic Fitting interface.

The third pane is used for interpolating or extrapolating a fit. It appears when you click the right arrow button a second time.
At the top of the first pane is the Select data window which contains the names of all the data sets you display in the Figure window associated with the Basic Fitting interface. Use this menu to select the data set to be fit. You can perform multiple fits for the current data set. Use the Plot Editor to change the name of it data set. The remaining items on the first pane are used as follows.

• Center and scale X data. If checked. the data is centered at zero mean and scaled to unit standard deviation. You may need to center and scale your data to improve the accuracy of the subsequent numerical computations. As described in the previous section, a warning is returned to the Command window if a fit produces results that may be inaccurate.
• Plot fits. This panel allows you to visually explore one or more fits to the current data set

• Check to display fits on figure. Select the fits you want to display for the current data set. You can choose as many fits for a given data set as you want. However, if your data set has /I points, then you should use polynomials with, at most, /I coefficients. If you fit using polynomials with more than /I coefficients, the interface will automatically set a sufficient number of coefficients to 0 during the calculation so that a solution can be obtained.
• Show equations. If checked, the fit equation is displayed on the plot.
• Significant digits. Select the significant digits associated with the fit
coefficient display.
• Plot residuals. If checked, the residuals are displayed. You can display the residuals as a bar plot, a scatter plot, a line plot using either the same. figure window as the data or using a separate figure window. If you plot multiple data sets as a subplot, then residuals can be plotted only in a separate figure window. See Figure 5.7-2.
• Show norm of residuals. If checked, the norm of residuals is displayed. The norm of residuals is a measure of the goodness of fit, where a smaller value indicates a better fit. The norm is the square root of the sum of the squares of the residuals.

A figure produced by the Basic Fitting interface.

A figure produced by the Basic Fitting interface.

The second pane of the Basic Fitting Interface is labeled Numerical Results. This pane enables you to explore the numerical results of a single fit to the current data set without plotting the fit. It contains three items.
• Fit. Use this menu to select an equation to fit to the current data set. The fit results are displayed in the box below the menu. Note that selecting an equation in this menu does not affect the state of the Plot fits selection. Therefore, if you want to display the fit in the data plot, you may need to check the relevant check box in Plot fits.
• Coefficients and norm of residuals. Displays the numerical results for the equation selected in Fit. Note that when you first open the Numerical Results panel, the results of the last fit you selected in Plot fits are displayed.

• Save to workspace. Launches a dialog box that allows you to save the fit results to workspace variables. The third pane of the Basic Fitting interface contains three items.

• Find Y = f (X). Use this to interpolate or extrapolate the current fit.
Enter a scalar or a vector of values corresponding to the independent variable (X). The current fit is evaluated after you click on the Evaluate button, and the results are displayed in the associated window. The current fit is displayed in the Fit window.
• Save to workspace. Launches a dialog box that allows you to save the evaluated results to workspace variables.
• Plot evaluated results. If checked, the evaluated results are displayed on the data plot

Posted on July 23, 2015 in advanced Plotting and Model Building

Share the Story

Back to Top
Share This