필터 지우기
필터 지우기

How to use mvnrnd function ?

조회 수: 19 (최근 30일)
Betha Shirisha
Betha Shirisha 2015년 4월 8일
댓글: Betha Shirisha 2015년 4월 10일
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

채택된 답변

Alka Nair
Alka Nair 2015년 4월 10일
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:
  댓글 수: 3
John D'Errico
John D'Errico 2015년 4월 10일
편집: John D'Errico 2015년 4월 10일
No, no no.
cases, the third argument is the NUMBER of samples to be generated. Those samples are independent of each other.
The covariance matrix is the covariance of those random variables, but not from sample to sample. Again, the samples are INDEPENDENT.
So if the random variable lives in a d-dimensional space, then you will need to pass in a vector of length d for mu, and a matrix of size dxd for sigma. Then expect that the result will be of size (cases,d).
Betha Shirisha
Betha Shirisha 2015년 4월 10일
@ john thanks..

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by