Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Surface Fitting

Interactive Surface Fitting

To interactively fit a surface, follow the steps in this simple example:

  1. Load some data at the MATLAB® command line.

    load franke

  2. Open the Curve Fitting app. Enter:

    cftool

  3. In the Curve Fitting app, select X Data, Y Data and Z Data.

    Curve Fitting app creates a default interpolation fit to the data.

  4. Choose a different model type using the fit category drop-down list, e.g., select Polynomial.

  5. Try different fit options for your chosen model type.

  6. Select File > Generate Code.

    Curve Fitting app creates a file in the Editor containing MATLAB code to recreate all fits and plots in your interactive session.

For more information about fitting surfaces in the Curve Fitting app, see Interactive Curve and Surface Fitting.

For details and examples of specific model types and fit analysis, see the following sections:

  1. Linear and Nonlinear Regression

  2. Interpolation

  3. Smoothing

  4. Fit Postprocessing

Programmatic Surface Fitting

To programmatically fit a surface, follow the steps in this simple example:

  1. Load some data.

    load franke
  2. Create a fit using the fit function, specifying the variables and a model type (in this case poly23 is the model type).

     f = fit( [x, y], z, 'poly23' )
  3. Plot your fit and the data.

    plot(f, [x,y], z)

To learn what functions you can use to create and work with fits, see: Curve and Surface Fitting.

For details and examples of specific model types and fit analysis, see the following sections:

  1. Linear and Nonlinear Regression

  2. Interpolation

  3. Smoothing

  4. Fit Postprocessing

See Also

Related Examples

Was this topic helpful?