【正文】
.As an alternative to specifying one of the named weight functions shown above, you can also write your own weight function (wfun) that takes a vector of scaled residuals as input and produces a vector of weights as output. For documentation on ROBUSTFIT, you can type doc robustfit (without quotes) at the MATLAB mand prompt or view the online documentation found at the URL below:For MATLAB versions prior to (R14SP3), we do not support a nonlinear weighted leastsquare fit in the Statistics Toolbox.In MATLAB (R14SP3), the demo Weighted Nonlinear Regression, addresses this and is also available on the web at the following link35====================2. Curve Fitting Toolbox====================We have a more general weighted least square regression capability in the Curve Fitting Toolbox that supports any fit, linear and nonlinear.The weight is part of the options to the Fit, and is supplied using the function FITOPTIONS. Go to the following URL for documentation on FITOPTIONS:In the Curve Fitting Toolbox, the weight can actually be any vector of weights associated with the response data.Follow this link for more information about this Toolbox:====================3. Optimization Toolbox.====================LSQNONLIN and LSQCURVEFIT are leastsquares solvers in the Optimization Toolbox that