Code covered by the BSD License  

Highlights from
UD Factorization & Kalman Filtering

UD Factorization & Kalman Filtering

by

 

15 Aug 2011 (Updated )

UD and LD factorization of nonnegative matrices and associated Kalman filter implementations.

[psd]=psdr(nx,nc)
% PSDR: Generate a random positive semi-definite
%       nx x nx matrix of rank nc.
%
%       function [psd]=psdr(nx,nc)
%
%       optional input: nc (nc=nx is assumed otherwise).
%
%       L.G. Van Willigenburg, W.L. De Koning, 28-11-95.
%
  function [psd]=psdr(nx,nc)

  if nx<0 || rem(nx,1)~=0;
    error('nx must be an integer > 0'); end;
  if nargin>1
    if nc<0 || nc>nx || rem(nc,1)~=0;
      error('nc must be an integer 0<=nc<=nx'); end;
  else nc=nx; end;
  if nc==0; psd=zeros(nx);
  else
    u=randn(nx); %toc; disp(' randn'); disp(' ');
    u(:,nc+1:nx)=0; %toc; disp(' zero u'); disp(' ');
    psd=u*u'; %toc; disp(' uu'); disp(' ');
  end

Contact us