my question is that

a=randn(400); generates 400*400 matrix in matlab,
my question is that this function generates different mean and variance matrix at every time when i run the code. so i require fix mean and variance matrix at every time when i run the code. (not a nearest,every time exact and fixed value)

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 12 月 27 日
編集済み: Azzi Abdelmalek 2012 年 12 月 27 日

0 投票

nm=[400,400]
v=0.5; %variance
m=2; % mean
out=m+sqrt(v)*randn(nm)

5 件のコメント

vipul utsav
vipul utsav 2012 年 12 月 27 日
編集済み: vipul utsav 2012 年 12 月 27 日
also i have tried this,but here,m and v is slightly change when i run the code more than one time,
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 12 月 27 日
編集済み: Azzi Abdelmalek 2012 年 12 月 27 日
What do you mean by it changes? 0.501 and 0.503 is that what you mean is changing? Bigger your matrix is, smaller will be the error
vipul utsav
vipul utsav 2012 年 12 月 27 日
0.5041 0.4958 0.4987 0.4975
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 12 月 27 日
The error is 1%. What is the desired precision ?
vipul utsav
vipul utsav 2012 年 12 月 27 日
ok, is there any idea for reduce this error or any other logic/function?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by