Yes. Use the curve fitting toolbox.
help fittype
fittype - Fit type for curve and surface fitting
This MATLAB function creates the fittype object aFittype for the model
specified by libraryModelName.
Syntax
aFittype = fittype(libraryModelName)
aFittype = fittype(expression)
aFittype = fittype(expression,Name,Value)
aFittype = fittype(linearModelTerms)
aFittype = fittype(linearModelTerms,Name,Value)
aFittype = fittype(anonymousFunction)
aFittype = fittype(anonymousFunction,Name,Value)
Input Arguments
libraryModelName - Library model to fit
character vector | string scalar
expression - Model to fit
character vector | string scalar
linearModelTerms - Model to fit
cell array of character vectors | string array
anonymousFunction - Model to fit
anonymous function
Name-Value Arguments
coefficients - Coefficient names
character vector | string scalar | cell array of character vectors |
string array
dependent - Dependent variable name
y (default) | character vector | string scalar
independent - Independent variable names
x (default) | character vector | string scalar |
cell array of character vectors | string array
options - Fit options
fitoptions
problem - Problem-dependent (fixed) parameter names
character vector | string scalar | cell array of character vectors |
string array
Output Arguments
aFittype - Model to fit
fittype object
Examples
openExample('curvefit/CreateFitTypesforLibraryModelsExample')
openExample('curvefit/CreateCustomNonlinearModelsandSpecifyProblemParametersanExample')
openExample('curvefit/CreateCustomLinearModelExample')
openExample('curvefit/FitACurveDefinedByAFileExample')
web /MATLAB/help/curvefit/fittype.html#btpaend-11
web /MATLAB/help/curvefit/fittype.html#btpaend-14
web /MATLAB/help/curvefit/fittype.html#btpaend-15
See also fit, fitoptions, Curve Fitter
Introduced in Curve Fitting Toolbox before R2006a
Documentation for fittype
doc fittype
help fit
fit - Fit curve or surface to data
This MATLAB function creates the fit to the data in x and y with the
model specified by fitType.
Syntax
fitobject = fit(x,y,fitType)
fitobject = fit([x,y],z,fitType)
fitobject = fit(x,y,fitType,fitOptions)
fitobject = fit(x,y,fitType,Name=Value)
[fitobject,gof] = fit(x,y,fitType)
[fitobject,gof,output] = fit(x,y,fitType)
Input Arguments
x - Data to fit
matrix
y - Data to fit
vector
z - Data to fit
vector
fitType - Model type to fit
character vector | string scalar | string array |
cell array of character vectors | anonymous function | fittype
fitOptions - Algorithm options
fitoptions
Name-Value Arguments
Options for All Fitting Methods
Normalize - Option to center and scale data
'off' (default) | 'on'
Exclude - Points to exclude from fit
expression | index vector | logical vector | empty
Weights - Weights for fit
[ ] (default) | vector
problem - Values to assign to problem-dependent constants
cell array | double
Smoothing Options
SmoothingParam - Smoothing parameter
scalar value in the range (0,1)
Span - Proportion of data points to use in local regressions
0.25 (default) | scalar value in the range (0,1)
Interpolation Options
ExtrapolationMethod - Extrapolation method
"auto" (default) | "none" | "linear" | "nearest" | "thinplate" |
"biharmonic" | "pchip" | "cubic"
Linear and Nonlinear Least-Squares Options
Robust - Robust linear least-squares fitting method
'off' (default) | LAR | Bisquare
Lower - Lower bounds on coefficients to be fitted
[ ] (default) | vector
Upper - Upper bounds on coefficients to be fitted
[ ] (default) | vector
Nonlinear Least-Squares Options
StartPoint - Initial values for the coefficients
[ ] (default) | vector
Algorithm - Algorithm to use for fitting procedure
'Trust-Region' (default) | 'Levenberg-Marquardt'
DiffMaxChange - Maximum change in coefficients for finite difference gradients
0.1 (default)
DiffMinChange - Minimum change in coefficients for finite difference gradients
10^{–8} (default)
Display - Display option in Command Window
'notify' (default) | 'final' | 'iter' | 'off'
MaxFunEvals - Maximum number of evaluations of model allowed
600 (default)
MaxIter - Maximum number of iterations allowed for fit
400 (default)
TolFun - Termination tolerance on model value
10^{–6} (default)
TolX - Termination tolerance on coefficient values
10^{–6} (default)
Output Arguments
fitobject - Fit result
cfit | sfit
gof - Goodness-of-fit statistics
gof structure
output - Fitting algorithm information
output structure
Examples
openExample('curvefit/FitaQuadraticCurveExample')
openExample('curvefit/FitaPolynomialSurfaceExample')
openExample('curvefit/FitaSurfaceUsingVariablesinaMATLABTableExample')
openExample('curvefit/CreateFitOptionsandFitTypeBeforeFittingExample')
openExample('curvefit/ComparePolynomialFitsforFitFunctionExample')
openExample('curvefit/FitaCubicPolynomialSpecifyingNormalizeandRobustOptionsExample')
openExample('curvefit/FitACurveDefinedByAFileExample')
openExample('curvefit/ExcludePointsfromFitExample')
openExample('curvefit/ExcludePointsandPlotFitShowingExcludedDataExample')
openExample('curvefit/CompareExtrapolationMethodsExample')
openExample('curvefit/FitaSmoothingSplineCurveandReturnGoodnessofFitInformatioExample')
openExample('curvefit/FitaSingleTermExponentialExample')
web /MATLAB/help/curvefit/fit.html#bto2vuv-11
openExample('curvefit/FindCoefficientOrdertoSetStartPointsandBoundsExample')
See also Curve Fitter, fittype, fitoptions, prepareCurveData,
prepareSurfaceData, feval, plot, confint
Introduced in Curve Fitting Toolbox before R2006a
Documentation for fit
doc fit
Other uses of fit
conbase/fit
conswitch/fit
contwostage/fit
fitproblem/fit
gmdistribution/fit
incrementalClassificationECOC/fit
incrementalClassificationKernel/fit
incrementalClassificationNaiveBayes/fit
incrementalDriftAwareLearner/fit
incrementalOneClassSVM/fit
incrementalPCA/fit
incrementalRegressionLinear/fit
incrementalRobustRandomCutForest/fit
lime/fit
linearDegradationModel/fit
localmod/fit
localmulti/fit
mbcmodel.model/fit
shapley/fit
tireModel/fit
xregmodel/fit
Note that the estimates of these coefficients will be very uncertain, due to the highly noisy data.