Main Content

Linear and Nonlinear Regression

Fit curves or surfaces with linear or nonlinear library models or custom models

Regression is a method of estimating the relationship between a response (output) variable and one or more predictor (input) variables. You can use linear and nonlinear regression to predict, forecast, and estimate values between observed data points. Curve Fitting Toolbox™ functions allow you to perform regression by fitting a curve or surface to data using the library of linear and nonlinear models, or custom equations.

Use the Curve Fitter app to fit curves and surfaces to data interactively. For more information, see Curve Fitting. You can also use the fit function to fit a curve or surface to a set of data at the command line. For a simple example, see Polynomial Curve Fitting.

Apps

Curve FitterFit curves and surfaces to data

Functions

expand all

excludedataExclude data from fit
fitFit curve or surface to data
fittypeFit type for curve and surface fitting
fitoptionsCreate or modify fit options object
prepareCurveData Prepare data inputs for curve fitting
prepareSurfaceDataPrepare data inputs for surface fitting
argnames Input argument names of cfit, sfit, or fittype object
categoryCategory of fit of cfit, sfit, or fittype object
coeffnamesCoefficient names of cfit, sfit, or fittype object
coeffvaluesCoefficient values of cfit or sfit object
dependnamesDependent variable of cfit, sfit, or fittype object
fevalEvaluate cfit, sfit, or fittype object
formulaFormula of cfit, sfit, or fittype object
getGet fit options structure property names and values
indepnamesIndependent variable of cfit, sfit, or fittype object
islinearDetermine if cfit, sfit, or fittype object is linear
numargsNumber of input arguments of cfit, sfit, or fittype object
numcoeffsNumber of coefficients of cfit, sfit, or fittype object
probnamesProblem-dependent parameter names of cfit, sfit, or fittype object
setAssign values in fit options structure
setoptions Set model fit options
typeName of cfit, sfit, or fittype object

Topics

Tutorials

  • Parametric Fitting
    Find all library model types for the Curve Fitter app and the fit function, set fit options, and optimize starting points.
  • Introduction to Least-Squares Fitting
    Perform least-squares fitting by using error distributions and linear, weighted, robust, and nonlinear least squares.
  • Polynomial Models
    Fit polynomials in the Curve Fitter app or with the fit function.
  • Exponential Models
    Fit exponential models in the Curve Fitter app or with the fit function.
  • Fit Logarithmic Models
    A logarithmic model has a steep initial period of growth before continuing to grow at a slower rate.
  • Fit Fourier Models
    Fit Fourier series models in the Curve Fitter app or with the fit function.
  • Gaussian Models
    Fit Gaussian models in the Curve Fitter app or with the fit function.
  • Power Series
    Fit power series models in the Curve Fitter app or with the fit function.
  • Rational Models
    Fit rational polynomial models in the Curve Fitter app or with the fit function.
  • Sum of Sines Models
    Fit sum of sines models in the Curve Fitter app or with the fit function.
  • Weibull Distributions
    Fit Weibull distribution models in the Curve Fitter app or with the fit function.
  • Fit Sigmoidal Models
    Sigmoidal models are S-shaped curves that are commonly used to model dose-response curves and population dynamics.
  • Custom Models
    If the Curve Fitting Toolbox library does not contain a desired parametric equation, you can create your own custom equation.
  • Custom Linear Fitting
    In the Curve Fitter app, you can use the Custom Equation fit to define your own linear or nonlinear equations.

Tools Workflow

Programmatic Workflow