Statistics Toolbox | ![]() ![]() |
Nonlinear least-squares data fitting by the Gauss-Newton method.
Syntax
[beta,r,J] = nlinfit(X,y,FUN,beta0)
Description
beta = nlinfit(X,y,FUN,beta0)
returns the coefficients of the nonlinear function described in FUN. FUN
can be a function handle specified using @
, an inline function, or a quoted text string containing the name of a function.
The function FUN has the form . It returns the predicted values of y given initial parameter estimates
and the independent variable X.
The matrix X
has one column per independent variable. The response, y
, is a column vector with the same number of rows as X
.
returns the fitted coefficients, [beta,r,J] = nlinfit(X,y,
FUN,beta0)
beta
, the residuals, r
, and the Jacobian, J
, for use with nlintool
to produce error estimates on predictions.
Example
load reaction
betafit = nlinfit(reactants,rate,@hougen,beta)
betafit = 1.2526 0.0628 0.0400 0.1124 1.1914
See Also
![]() | ncx2stat | nlintool | ![]() |