This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

List of Library Models for Curve and Surface Fitting

Use Library Models to Fit Data

You can use the Curve Fitting Toolbox™ library of models for data fitting with the fit function. You use library model names as input arguments in the fit, fitoptions, and fittype functions.

Library Model Types

The following tables describe the library model types for curves and surfaces.

  • Use the links in the table for examples and detailed information on each library type.

  • If you want a quick reference of model names for input arguments to the fit function, see Model Names and Equations.

Library Model Types for Curves



Distribution models such as Weibull. See Weibull Distributions.


Exponential function and sum of two exponential functions. See Exponential Models.


Up to eight terms of Fourier series. See Fourier Series.


Sum of up to eight Gaussian models. See Gaussian Models.


Interpolating models, including linear, nearest neighbor, cubic spline, and shape-preserving cubic spline. See Nonparametric Fitting.


Polynomial models, up to degree nine. See Polynomial Models.


Power function and sum of two power functions. See Power Series.


Rational equation models, up to 5th degree/5th degree (i.e., up to degree 5 in both the numerator and the denominator). See Rational Polynomials.


Sum of up to eight sin functions. See Sum of Sines Models.


Cubic spline and smoothing spline models. See Nonparametric Fitting.

Library Model Types for Surfaces



Interpolating models, including linear, nearest neighbor, cubic spline, biharmonic, and thin-plate spline interpolation. See Interpolation Methods.


Lowess smoothing models. See Lowess Smoothing.


Polynomial models, up to degree five. See Polynomial Models.

Model Names and Equations

To specify the model you want to fit, consult the following tables for a model name to use as an input argument to the fit function. For example, to specify a quadratic curve with model name “poly2” :

f = fit(x, y,  'poly2')

Polynomial Model Names and Equations

Examples of Polynomial Model Names for CurvesEquations
poly1Y = p1*x+p2
poly2Y = p1*x^2+p2*x+p3
poly3Y = p1*x^3+p2*x^2+...+p4
...etc., up to poly9Y = p1*x^9+p2*x^8+...+p10

For polynomial surfaces, model names are 'polyij', where i is the degree in x and j is the degree in y. The maximum for both i and j is five. The degree of the polynomial is the maximum of i and j. The degree of x in each term will be less than or equal to i, and the degree of y in each term will be less than or equal to j. See the following table for some example model names and equations, of many potential examples.

Examples of Polynomial Model Names for SurfacesEquations
poly21Z = p00 + p10*x + p01*y + p20*x^2 + p11*x*y
poly13 Z = p00 + p10*x + p01*y + p11*x*y + p02*y^2 + p12*x*y^2 + p03*y^3
poly55 Z = p00 + p10*x + p01*y +...+ p14*x*y^4 + p05*y^5

Distribution Model Name and Equation

Distribution Model NamesEquations
weibullY = a*b*x^(b-1)*exp(-a*x^b)

Exponential Model Names and Equations

Exponential Model NamesEquations
exp1Y = a*exp(b*x)
exp2Y = a*exp(b*x)+c*exp(d*x)

Fourier Series Model Names and Equations

Fourier Series Model NamesEquations
fourier1Y = a0+a1*cos(x*p)+b1*sin(x*p)
fourier2Y = a0+a1*cos(x*p)+b1*sin(x*p)... +a2*cos(2*x*p)+b2*sin(2*x*p)
fourier3Y = a0+a1*cos(x*p)+b1*sin(x*p)... +a3*cos(3*x*p)+b3*sin(3*x*p)
...etc., up to fourier8 Y = a0+a1*cos(x*p)+b1*sin(x*p)... +a8*cos(8*x*p)+b8*sin(8*x*p)

Where p = 2*pi/(max(xdata)-min(xdata)).

Gaussian Model Names and Equations

Gaussian Model NamesEquations
gauss1Y = a1*exp(-((x-b1)/c1)^2)
gauss2Y = a1*exp(-((x-b1)/c1)^2)+a2*... exp(-((x-b2)/c2)^2)
gauss3Y = a1*exp(-((x-b1)/c1)^2)+... +a3*exp(-((x-b3)/c3)^2)
...etc., up to gauss8 Y = a1*exp(-((x-b1)/c1)^2) +... +a8*exp(-((x-b8)/c8)^2)

Power Model Names and Equations

Power Model NamesEquations
power1Y = a*x^b
power2Y = a*x^b+c

Rational Model Names and Equations

Rational models are polynomials over polynomials with the leading coefficient of the denominator set to 1. Model names are ratij, where i is the degree of the numerator and j is the degree of the denominator. The degrees go up to five for both the numerator and the denominator.

Examples of Rational Model NamesEquations
rat02Y = (p1)/(x^2+q1*x+q2)
rat21Y = (p1*x^2+p2*x+p3)/(x+q1)
rat55Y = (p1*x^5+...+p6)/(x^5+...+q5)

Sum of Sine Model Names and Equations

Sum of Sine Model NamesEquations
sin1Y = a1*sin(b1*x+c1)
sin2Y = a1*sin(b1*x+c1)+a2*sin... (b2*x+c2)
sin3Y = a1*sin(b1*x+c1)+... +a3*sin(b3*x+c3)
...etc., up to sin8 Y = a1*sin(b1*x+c1)+... +a8*sin(b8*x+c8)

Spline Model Names

Spline models are supported for curve fitting, not for surface fitting.

Spline Model NamesDescription
cubicsplineCubic interpolating spline
smoothingsplineSmoothing spline

Interpolant Model Names

TypeInterpolant Model NamesDescription
Curves and SurfaceslinearinterpLinear interpolation
nearestinterpNearest neighbor interpolation
cubicinterpCubic spline interpolation
Curves onlypchipinterpShape-preserving piecewise cubic Hermite (pchip) interpolation
Surfaces onlybiharmonicinterp

Biharmonic (MATLAB® griddata) interpolation

thinplateinterpThin-plate spline interpolation

Lowess Model Names

Lowess models are supported for surface fitting, not for curve fitting.

Lowess Model NamesDescription
lowessLocal linear regression
loessLocal quadratic regression