Hi - please what is the difference between normrnd and randn ?

124 ビュー (過去 30 日間)
Mohamad
Mohamad 2018 年 7 月 4 日
編集済み: Jan 2018 年 7 月 4 日
How to use normrnd to generate random numbers from normal distribution with specific mean and variance ?

採用された回答

Jan
Jan 2018 年 7 月 4 日
編集済み: Jan 2018 年 7 月 4 日
1. what is the difference between normrnd and randn?
doc normrnd
r = normrnd(mu,sigma) generates a random number from the normal distribution with mean
parameter mu and standard deviation parameter sigma.
doc randn
X = randn returns a random scalar drawn from the standard normal distribution.
"Standard normal distribution" is a mean of 0.0 and a standard deviation of 1.0 . This means:
normrnd(mu, sigma) = randn * sigma + mu
2. How to use normrnd to generate random numbers from normal distribution with specific mean and variance ?
Simply by calling: normrnd(mu, sigma)
Remember that normrnd uses the standard deviation, which is the square root of the variance.
Do you know the doc and help commands? You find the documentation of the current Matlab version online also: https://www.mathworks.com/help/index.html

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by