www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodel/cov.m

    function c = cov(m)
%COV Covariance matrix
%
%  C = COV(M)
%
%  The covariance is given by cov = Ri*Ri' where ri is the information matrix
%  and is given by Ri = var( m ) = or by Ri*Ri' = inv( X'*X ) * mse. Thus 
%  cov( m ) = inv( X'*X ) * mse, where mse is the mean square error and X is the
%  Jacobian of the model.
%
%  As we don't know the MSE we assume that it is 1 as this should only be used
%  by designs.
%
%  The information matrix needs to be stored in the model via a call to
%  VAR(M,...). This is usually done by the INITSTORE method.
%  
%  See also XREGLINEAR/COV, XREGUSERMOD/CALCJACOB, XREGMODEL/INITSTORE,
%    XREGMODEL/VAR.

%  Copyright 2000-2006 The MathWorks, Inc. and Ford Global Technologies, Inc.

% The information matrix is stored in the model. This can be accessed by a call
% to var.
ri = var( m );
if ~isempty(ri)
    % Compute the variance.
    c = ri*ri';
else
    % default covariance
    c= zeros(numParams(m));
end

%------------------------------------------------------------------------------|
% EOF
%--------------------------------------------------------------------------
%----|