## 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`

Distribution models such as Weibull. See Weibull Distributions.

`exponential`

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

`fourier`

Up to eight terms of Fourier series. See Fit Fourier Models.

`gaussian`

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

`interpolant`

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

`polynomial`

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

`power`

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

`rational`

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.

`sin`

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

`spline`

Cubic spline and smoothing spline models. See Nonparametric Fitting.

Library Model Types for Surfaces

Description

`interpolant`

Interpolating models, including linear, nearest neighbor, cubic spline, biharmonic, and thin-plate spline interpolation. See Interpolation with Curve Fitting Toolbox.

`lowess`

Lowess smoothing models. See Lowess Smoothing.

`polynomial`

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
`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 `'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
`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 NamesEquations
`weibull````Y = a*b*x^(b-1)*exp(-a*x^b)```

#### Exponential Model Names and Equations

Exponential Model NamesEquations
`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 NamesEquations
`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 NamesEquations
`gauss1````Y = a1*exp(-((x-b1)/c1)^2)```
`gauss2````Y = a1*exp(-((x-b1)/c1)^2)+a2*exp(-((x-b2)/c2)^2)```
`gauss3````Y = 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
`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 NamesEquations
`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 NamesEquations
`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)```

#### Spline Model Names

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

Spline Model NamesDescription
`cubicspline`Cubic interpolating spline
`smoothingspline`Smoothing spline

#### Interpolant Model Names

TypeInterpolant Model NamesDescription
Curves and Surfaces`linearinterp`Linear interpolation
`nearestinterp`Nearest neighbor interpolation
`cubicinterp`Cubic spline interpolation
Curves only`pchipinterp`Shape-preserving piecewise cubic Hermite (pchip) interpolation
Surfaces only`biharmonicinterp`

Biharmonic (MATLAB® `griddata`) interpolation

`thinplateinterp`Thin-plate spline interpolation

#### Lowess Model Names

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

Lowess Model NamesDescription
`lowess`Local linear regression
`loess`Local quadratic regression
{"ft_lang_label":"__label__en","ft_lang_prob":0.69171286,"math_prob":0.99717945,"size":5390,"snap":"2023-14-2023-23","text_gpt3_token_len":1683,"char_repetition_ratio":0.16134423,"word_repetition_ratio":0.060025543,"special_character_ratio":0.2820037,"punctuation_ratio":0.115384616,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9990695,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-30T21:28:36Z\",\"WARC-Record-ID\":\"<urn:uuid:e1f2b99a-41b1-46d2-b68d-0de84696c7f2>\",\"Content-Length\":\"90849\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cb9b9591-52bc-4e2b-9f74-90c0bd7da632>\",\"WARC-Concurrent-To\":\"<urn:uuid:f54cd6f1-1a3b-4d92-80c0-94fbfab9bb99>\",\"WARC-IP-Address\":\"104.86.80.92\",\"WARC-Target-URI\":\"https://fr.mathworks.com/help/curvefit/list-of-library-models-for-curve-and-surface-fitting.html\",\"WARC-Payload-Digest\":\"sha1:XAKP7FBVC47SIPE2IQFMO5QQ5FSJU4GD\",\"WARC-Block-Digest\":\"sha1:XUVA6A3N7TIF6PGDFLTUMEYAVT7JRJGG\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224646144.69_warc_CC-MAIN-20230530194919-20230530224919-00425.warc.gz\"}"}