www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregusermod/initial.m
function [p0,LB,UB,OK] = initial(U,varargin) %INITIAL initial parameters for xregusermod % % [p0,LB,UB,OK] = initial(U) % [p0,LB,UB,OK] = initial(U,x,y); % Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. try [p0,OK] = feval(U.funcName,U,'initial',varargin{:}); p0= p0(:); np= numParams(U); if ~isnumeric(p0) || ~all(size(p0)==[np,1]) error(message('mbc:xregusermod:InvalidSizes', np, name( U ))) end [LB,UB] = constraints(U); if isempty(p0) np= numParams(U); % user upper and lower bounds to find an initial guess LB(~isfinite(LB)) = 0; UB(~isfinite(UB)) = 0; if isempty(LB) % no lower bound if isempty(UB) p0 = zeros(np,1); else p0 = min(UB,0); end elseif isempty(UB) % no upper bound p0 = max(LB,0); else % use mid starting point between LB and UB p0= LB + (UB-LB)/2; end end p0(~isfinite(p0))= 0; % make sure that initial parameters are a column vector p0 = p0(:); LB = LB(:); UB = UB(:); catch ME ReportError(U,ME) % model not OK so don't try and fit p0 = double(U); LB = []; UB = []; OK = false; end