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  Description 

 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 Fit Fourier Models. 
 Sum of up to eight Gaussian models. See Gaussian Models. 
 Interpolating models, including linear, nearest neighbor, cubic spline, and shapepreserving cubic spline. See Nonparametric Fitting. 
logarithmic  Logarithmic models, including natural log, log base 2, and log base 10. See Fit Logarithmic Models. 
 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 Models. 
 Sum of up to eight sin functions. See Sum of Sines Models. 
sigmoidal  Sigmoidal models including logistic, 4parameter logistic, and Gompertz. See Fit Sigmoidal Models. 
 Cubic spline and smoothing spline models. See Nonparametric Fitting. 
Library Model Types for Surfaces  Description 

 Interpolating models, including linear, nearest neighbor, cubic spline, biharmonic, and thinplate spline interpolation. See Interpolation with Curve Fitting Toolbox. 
 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 Curves  Equations 

poly1  Y = p1*x+p2 
poly2  Y = p1*x^2+p2*x+p3 
poly3  Y =
p1*x^3+p2*x^2+...+p4 
...etc., up to
poly9  Y =
p1*x^9+p2*x^8+...+p10 
For polynomial surfaces, model names are
'poly
,
where ij
'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 Surfaces  Equations 

poly21  Z = 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 Names  Equations 

weibull  Y =
a*b*x^(b1)*exp(a*x^b) 
Exponential Model Names and Equations
Exponential Model Names  Equations 

exp1  Y = a*exp(b*x) 
exp2  Y =
a*exp(b*x)+c*exp(d*x) 
Fourier Series Model Names and Equations
Fourier Series Model Names  Equations 

fourier1  Y = a0+a1*cos(x*p)+b1*sin(x*p)

fourier2  Y =
a0+a1*cos(x*p)+b1*sin(x*p)+a2*cos(2*x*p)+b2*sin(2*x*p)

fourier3  Y =
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 Names  Equations 

gauss1  Y =
a1*exp(((xb1)/c1)^2) 
gauss2  Y =
a1*exp(((xb1)/c1)^2)+a2*exp(((xb2)/c2)^2) 
gauss3  Y =
a1*exp(((xb1)/c1)^2)+...+a3*exp(((xb3)/c3)^2) 
...etc., up to gauss8

Y =
a1*exp(((xb1)/c1)^2)+...+a8*exp(((xb8)/c8)^2)

Logarithmic Model Names and Equations
Logarithmic Model Names  Equations 

log  Y = a*log(x)+b 
log10  Y = a*log10(x)+b 
log2  Y = a*log2(x)+b 
Power Model Names and Equations
Power Model Names  Equations 

power1  Y = a*x^b 
power2  Y = 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
rat
ij
, 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 Names  Equations 

rat02  Y =
(p1)/(x^2+q1*x+q2) 
rat21  Y =
(p1*x^2+p2*x+p3)/(x+q1) 
rat55  Y =
(p1*x^5+...+p6)/(x^5+...+q5) 
Sum of Sine Model Names and Equations
Sum of Sine Model Names  Equations 

sin1  Y =
a1*sin(b1*x+c1) 
sin2  Y =
a1*sin(b1*x+c1)+a2*sin(b2*x+c2) 
sin3  Y =
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) 
Sigmoidal Model Names and Equations
Sigmoidal Model Names  Equations 

logistic  Y =
a/(1+exp(b*(xc))) 
logistic4  Y =
d+(ad)/(1+(x/c)^b) 
gompertz  Y =
d+(ad)*exp(exp(b*(xc))) 
Spline Model Names
Spline models are supported for curve fitting, not for surface fitting.
Spline Model Names  Description 

cubicspline  Cubic interpolating spline 
smoothingspline  Smoothing spline 
Interpolant Model Names
Type  Interpolant Model Names  Description 

Curves and Surfaces  linearinterp  Linear interpolation 
nearestinterp  Nearest neighbor interpolation  
cubicinterp  Cubic spline interpolation  
Curves only  pchipinterp  Shapepreserving piecewise cubic Hermite (pchip) interpolation 
Surfaces only  biharmonicinterp  Biharmonic (MATLAB^{®}

thinplateinterp  Thinplate spline interpolation 
Lowess Model Names
Lowess models are supported for surface fitting, not for curve fitting.
Lowess Model Names  Description 

lowess  Local linear regression 
loess  Local quadratic regression 