www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodel/nonlin_sse.m
function [s,g]= nonlin_sse(p,m,varargin); % MODEL/NONLIN_SSE nonlinear sum of squares error % % for nonlinear mle problem % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. m=update(m,p); if nargout<2 r= lsqcost(p,m,varargin{:}); else [r,J]= lsqcost(p,m,varargin{:}); % gradient g= -2*r'*J/length(r); end % cost function s= sum(r.^2)/length(r);