how can i use mvnrnd function?

4 ビュー (過去 30 日間)
RADWAN A F ZEYADI
RADWAN A F ZEYADI 2022 年 1 月 11 日
回答済み: Paul 2022 年 1 月 12 日
Hi
i have used this function in order to generate gaussian random numbers
this funtion needs to define the mean and mu wich is square matrix my question is how to draw hundreds of values followin gaussian assumption
i upload the photos as aresult of single value and when i try to generate hundreds values i lost the correlation between them any idea please?

回答 (1 件)

Paul
Paul 2022 年 1 月 12 日
I'm not exactly sure what the question is.
If the question is: how to draw hundres of samples from the multi-variate normal distribution with a given mean and covariance, then an example is:
mu = [1 2];
Sigma = [1 2;3 4]*[1 2;3 4].';
x = mvnrnd(mu,Sigma,900); % 900 samples
% verify
mu
mu = 1×2
1 2
mean(x)
ans = 1×2
1.0546 2.1085
Sigma
Sigma = 2×2
5 11 11 25
cov(x)
ans = 2×2
5.2979 11.7244 11.7244 26.7540

カテゴリ

Help Center および File ExchangeMultivariate Distributions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by