MATLAB: How to use mvnrnd function

mvnrnd function

How to use mvnrnd function ?
I need to generate a matrix whose elements follow normal distribution with zero mean and Q covariance matrix . I know Q (some positive definite matrix)
I'm using the following code
Q size is (4,4) MU=zeros(1,4); noise=mvnrnd(MU,Q,10)+1j*mvnrnd(MU,Q,10);
MY noise size should be (4,10) but i m getting size as (10,4)
Thanks

Best Answer

The documentation of MVNRND suggests that the syntax is
>> r = mvnrnd(MU,SIGMA,cases) and r = mvnrnd(MU,SIGMA,cases) returns a cases-by-d matrix R of random vectors chosen from the multivariate normal distribution with a common 1-by-d mean vector MU, and a common d-by-d covariance matrix SIGMA. As cases is 10 in your case and d is 4, you are observing the dimension 10*4 for 'noise'.
Please refer to the documentation at: