www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodel/pev.m
function [p,yhat]=pev(m,x,Natural,varargin) %PEV evaulate pev % Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin<=2 || Natural x= code(m,x); end if isnumeric(x) nc= size(x,1); % when calculating the size of the chunks, cope with size(m,1)==0 np= ceil( 1e6/max( size( m, 1 ), 1 ) ); niter=floor(nc./np); nover=rem(nc,np); p= zeros(nc,1); for n=1:niter lns= (1:np)+(n-1).*np; p(lns)= evalpev(x(lns,:),m,varargin{:}); end if nover % last load of points (<10000) lns= (1:nover)+(niter).*np; p(lns)= evalpev(x(lns,:),m,varargin{:}); end else p= evalpev(x,m,varargin{:}); end if nargout>1 || HasTransform(m.Output) yhat = yinv(m,eval(m,x)); % Calculate inverse transformation dy = yinvdiff(m,yhat); p= dy.^2.*p; end if ~isreal(p) p(abs(imag(p))>1e-6)=NaN; p= real(p); end p(p<0)=NaN; if nargout>1 && ~isreal(yhat) yhat(abs(imag(yhat))>1e-6)=NaN; yhat= real(yhat); end