Using normrnd to generate a random sequence

1 回表示 (過去 30 日間)
Nat
Nat 2018 年 2 月 12 日
コメント済み: Nat 2018 年 2 月 12 日
I'm trying to use the function 'normrnd' to generate a zero-mean random sequence distributed uniformly between +/- 0.25. How do I go about doing this?

採用された回答

Roger Stafford
Roger Stafford 2018 年 2 月 12 日
The best answer to your question is, “don’t use ‘normrnd’ for that purpose!” It is very much the wrong distribution for that.
You should use ‘rand’ as follows:
x = 0.5*rand(m,n)-0.25;
This will give you a statistically uniform distribution between -0.25 and +0.25, and nowhere else.
  2 件のコメント
John BG
John BG 2018 年 2 月 12 日
編集済み: John BG 2018 年 2 月 12 日
Hi Nat
.. to generate a .. random sequence ..
x = 0.5*rand(1,n)-0.25
or
x = 0.5*rand(n,1)-0.25
not m sequences
John BG
Nat
Nat 2018 年 2 月 12 日
Thanks to both of you for your help!

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

その他の回答 (0 件)

カテゴリ

Help Center および 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