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!