フィルターのクリア

how to generate a uniform random variable with mean zero and variance ten?

4 ビュー (過去 30 日間)
bsd
bsd 2011 年 8 月 5 日
コメント済み: Steven Lord 2017 年 11 月 27 日
Dear sir/madam,
I need to generate a uniform random variable with mean 0, and variance 10 for my project. How could I generate this in matlab? Looking forward to hearing from you soon.
Thanking you, BSD

回答 (2 件)

Daniel Shub
Daniel Shub 2011 年 8 月 5 日
((2*rand)-1)*sqrt(12/4)*sqrt(10)
The ((2*rand)-1) gives you a random variable with zero mean and a variance of 4/12. The rest scales it to a variance of 10.

Praveen Pawar
Praveen Pawar 2017 年 11 月 27 日
Below expression will generate 1000 random numbers of any mean and standard deviation. And SD = sqrt(var)
y = standard_deviation.*randn(1000,1) + mean
  1 件のコメント
Steven Lord
Steven Lord 2017 年 11 月 27 日
The line of code you've written is fine for solving a question about generating random numbers, but it will not solve the original question.
Part of that original question, with some emphasis added, was "I need to generate a uniform random variable". The randn function generates normally distributed pseudorandom numbers.

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

カテゴリ

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