function X=multnormrnd(n,MN,SIGMA) %generates n observations with covariance matrix SIGMA % changed november 2002 to include MN p=size(SIGMA); A=msqrt(SIGMA); MN=reshape(MN,1,p(1)); X=randn(n,p(1))*A; X=X+repmat(MN,n,1); %add on the mean