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曲线拟合app to fit curves and surfaces to data interactively. For more information, see曲线拟合. You can also use thefitfunction to fit a curve or surface to a set of data at the command line. For a simple example, seePolynomial Curve Fitting.

Apps

曲线拟合 Fit curves and surfaces to data

Functions

expand all

excludedata Exclude data from fit
fit Fit curve or surface to data
fittype Fit type for curve and surface fitting
fitoptions Create or modify fit options object
prepareCurveData Prepare data inputs for curve fitting
prepareSurfaceData Prepare data inputs for surface fitting
argnames Input argument names ofcfit,sfit, orfittypeobject
category Category of fit ofcfit,sfit, orfittypeobject
coeffnames Coefficient names ofcfit,sfit, orfittypeobject
coeffvalues Coefficient values ofcfitorsfitobject
dependnames Dependent variable ofcfit,sfit, orfittypeobject
feval Evaluatecfit,sfit, orfittypeobject
formula Formula ofcfit,sfit, orfittypeobject
get Get fit options structure property names and values
indepnames Independent variable ofcfit,sfit, orfittypeobject
islinear Determine ifcfit,sfit, orfittypeobject is linear
numargs Number of input arguments ofcfit,sfit, orfittypeobject
numcoeffs Number of coefficients ofcfit,sfit, orfittypeobject
probnames Problem-dependent parameter names ofcfit,sfit, orfittypeobject
set 在合适的选项赋值的结构
setoptions Set model fit options
type Name ofcfit,sfit, orfittypeobject

Topics

Tutorials

Parametric Fitting

Find all library model types for Curve Fitting app and thefitfunction, set fit options and optimize starting points.

Least-Squares Fitting

Least-squares fitting in Curve Fitting Toolbox, including error distributions, linear, weighted, robust, and nonlinear least squares.

Polynomial Models

Fit polynomials in Curve Fitting app or with thefitfunction.

Exponential Models

Fit exponential models in Curve Fitting app or with thefitfunction.

Fourier Series

Fit Fourier series models in Curve Fitting app or with thefitfunction.

Gaussian Models

Fit Gaussian models in Curve Fitting app or with thefitfunction.

Power Series

Fit power series models in Curve Fitting app or with thefitfunction.

Rational Polynomials

Fit rational polynomial models in Curve Fitting app or with thefitfunction.

Sum of Sines Models

Fit sum of sines models in Curve Fitting app or with thefitfunction.

Weibull Distributions

Fit Weibull distribution models in Curve Fitting app or with thefitfunction.

Custom Models

If the toolbox library does not contain a desired parametric equation, you can create your own custom equation.

Tools Workflow

Interactive Curve and Surface Fitting

Fit curves and surfaces to data using Curve Fitting app: select data, choose model types, and save sessions.

Data Selection

Select data to fit curves and surfaces in Curve Fitting app, identify compatible size data and troubleshoot data problems.

Compare Fits in Curve Fitting App

Search for the best fit by creating multiple fits, comparing graphical and numerical results including fitted coefficients and goodness-of-fit statistics, and analyzing your best fit in the workspace.

Surface Fitting to Franke Data

Create and compare surface fits in Curve Fitting app using example data.

Surface Fitting to Biopharmaceutical Data

曲线拟合Toolbox software provides some example data for an anesthesia drug interaction study.

Custom Nonlinear ENSO Data Analysis

This example fits the ENSO data using several custom nonlinear equations.

Gaussian Fitting with an Exponential Background

This example fits two poorly resolved Gaussian peaks on a decaying exponential background using a general (nonlinear) custom model.

Programmatic Workflow

Curve and Surface Fitting

Workflow for programmatic curve and surface fitting in Curve Fitting Toolbox.

Polynomial Curve Fitting

This example shows how to fit polynomials up to sixth degree to some census data using Curve Fitting Toolbox™.

Custom Nonlinear Census Fitting

This example shows how to fit a custom equation to census data, specifying bounds, coefficients, and a problem-dependent parameter.

Surface Fitting With Custom Equations to Biopharmaceutical Data

This example shows how to use Curve Fitting Toolbox™ to fit response surfaces to some anesthesia data to analyze drug interaction effects.

Featured Examples