generating a random variable with a given mean and matrix
조회 수: 3 (최근 30일)
이전 댓글 표시
can any one tell me how to generate a NORMAL DISTRIBUTION random variable X = N(mu,A), where mu is the mean (mu = 0, 0 mean) and A is a p*p IDENTITY MATRIX. Please ask me if the question is unclear. Thanks
채택된 답변
Image Analyst
2016년 10월 15일
Like this?
numRows = size(A, 1);
A(logical(eye(numRows))) = randn(1, numRows)
댓글 수: 8
Image Analyst
2016년 10월 15일
I don't believe you can do that and have the random variable be random. If it's random, you won't have A=eye(10) for the covariance matrix.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!