求救啊!
楼主 · 1 楼
2 楼
我刚刚接触Matlab啊,谁能帮我解释下这个命令啊,小弟在这儿先谢过了!
nlinfit,再次谢谢哦!
nlinfit,再次谢谢哦!
3 楼
nlinfit
Nonlinear least squares regression
Syntax
beta = nlinfit(X,y,fun,beta0)
[beta,r,J] = nlinfit(X,y,fun,beta0)
[...] = nlinfit(X, y, fun, beta0, options)
Description
beta = nlinfit(X,y,fun,beta0) estimates the coefficients of a nonlinear regression function using least squares. y is a vector of response (dependent variable) values. Typically, X is a design matrix of predictor (independent variable) values, with one row for each value in y. However, X can be any array that fun can accept. fun is a function, specified using the @ sign, of the form
yhat = myfun(beta,X)
where beta is a coefficient vector. fun returns a vector yhat of fitted y values. beta0 is a vector containing initial values for the coefficients.
[beta,r,J] = nlinfit(X,y,fun,beta0) returns the fitted coefficients, beta, the residuals, r, and the Jacobian, J. You can use these outputs with nlpredci to produce error estimates on predictions, and with nlparci to produce error estimates on the estimated coefficients.
Note nlintool provides a GUI for performing nonlinear fits and computing confidence intervals.
[...] = nlinfit(X, y, fun, beta0, options) accepts the input argument options, a structure that sets parameters for the algorithm used in nlinfit. You can create options using statset. The fields of options are
* MaxIter — Maximum number of iterations allowed. The default is 100.
* TolFun — Termination tolerance on the residual sum of squares. The defaults is 1e-8.
* TolX — Termination tolerance on the estimated coefficients beta. The default is 1e-8.
* Display — Level of display output during estimation. The choices are
o 'off' (the default),
o 'iter'
o 'final'
* 'DerivStep' — Relative difference used in finite difference gradient calculation. May be a scalar, or the same size as the parameter vector beta0. The default is eps^(1/3).
* 'FunValCheck' — Check for invalid values, such as NaN or Inf, from the objective function. Values are 'off' or 'on' (the default).
nlinfit treats NaNs in y or fun(beta, X) as missing data and ignores the corresponding rows.
Example
Find the coefficients that best fit the data in reaction.mat. The chemistry behind this data set deals with reaction kinetics as a function of the partial pressure of three chemical reactants: hydrogen, n-pentane, and isopentane.
The hougen function uses the Hougen-Watson model for reaction kinetics to return the predicted values of the reaction rate.
load reaction
betafit = nlinfit(reactants,rate,@hougen,beta)
betafit = 1.2526
0.0628
0.0400
0.11
24
1.1914
Reference
[1] Seber, G. A. F, and C. J. Wild, Nonlinear Regression, Wiley, 1989.
Nonlinear least squares regression
Syntax
beta = nlinfit(X,y,fun,beta0)
[beta,r,J] = nlinfit(X,y,fun,beta0)
[...] = nlinfit(X, y, fun, beta0, options)
Description
beta = nlinfit(X,y,fun,beta0) estimates the coefficients of a nonlinear regression function using least squares. y is a vector of response (dependent variable) values. Typically, X is a design matrix of predictor (independent variable) values, with one row for each value in y. However, X can be any array that fun can accept. fun is a function, specified using the @ sign, of the form
yhat = myfun(beta,X)
where beta is a coefficient vector. fun returns a vector yhat of fitted y values. beta0 is a vector containing initial values for the coefficients.
[beta,r,J] = nlinfit(X,y,fun,beta0) returns the fitted coefficients, beta, the residuals, r, and the Jacobian, J. You can use these outputs with nlpredci to produce error estimates on predictions, and with nlparci to produce error estimates on the estimated coefficients.
Note nlintool provides a GUI for performing nonlinear fits and computing confidence intervals.
[...] = nlinfit(X, y, fun, beta0, options) accepts the input argument options, a structure that sets parameters for the algorithm used in nlinfit. You can create options using statset. The fields of options are
* MaxIter — Maximum number of iterations allowed. The default is 100.
* TolFun — Termination tolerance on the residual sum of squares. The defaults is 1e-8.
* TolX — Termination tolerance on the estimated coefficients beta. The default is 1e-8.
* Display — Level of display output during estimation. The choices are
o 'off' (the default),
o 'iter'
o 'final'
* 'DerivStep' — Relative difference used in finite difference gradient calculation. May be a scalar, or the same size as the parameter vector beta0. The default is eps^(1/3).
* 'FunValCheck' — Check for invalid values, such as NaN or Inf, from the objective function. Values are 'off' or 'on' (the default).
nlinfit treats NaNs in y or fun(beta, X) as missing data and ignores the corresponding rows.
Example
Find the coefficients that best fit the data in reaction.mat. The chemistry behind this data set deals with reaction kinetics as a function of the partial pressure of three chemical reactants: hydrogen, n-pentane, and isopentane.
The hougen function uses the Hougen-Watson model for reaction kinetics to return the predicted values of the reaction rate.
load reaction
betafit = nlinfit(reactants,rate,@hougen,beta)
betafit = 1.2526
0.0628
0.0400
0.11
24
1.1914
Reference
[1] Seber, G. A. F, and C. J. Wild, Nonlinear Regression, Wiley, 1989.
4 楼
支持,或者直接安装帮助文件,然后打开MATLAB HELP ,基本上都可以找到满意的答案啊。
5 楼
呵呵,编程呀,我只会C语言呀,今年学了一眯MALAB