The command normrnd times a scalar

Hi,
I would like to know how Matlab understands the following:
eta=normrnd(0,sigma)/100
Is this command going to re-scale eta by 100 or multiply the normrnd(0,sigma) by 1/100 and therefore the variance is (sigma/100)^(2)
Can somone clarify this point for me ?
Many thanks

Answers (1)

It is going to multiply by 1/100.

4 Comments

Thanks, so the variance that Matlab will accept effectively is (sigma/100)^(2). So if I want to rescale the random variables I should proceed in two steps. Something like:
eta=normrnd(0,sigma)
eta=eta/100;
eta=normrnd(0,sigma)/100 is identical to the pair of lines of code. normrnd() is computed and the result is divided by 100. normrnd() does not know anything about the division. It is not, for example, the same as eta=normrnd(0,sigma/100) .
When you rescale a random variable you change the variance of the random variable. You cannot separate rescaling and changing the variance.
I see, I now got your point. All it matters for me is whether eta=normrnd(0,sigma/100) and eta=normrnd(0,sigma)/100 are equivalent. I thank you very much.
normrnd is randn() * sigma + mu. Your mu is 0, so your normrnd() calls are randn() * sigma . It then does not matter if you pass sigma/100 or if you divide the result of the normrnd() by 100.
If the mu was not 0 then the two situations would not be the same.

Sign in to comment.

Categories

Find more on Random Number Generation in Help Center and File Exchange

Asked:

msh
on 12 Jul 2015

Commented:

on 12 Jul 2015

Community Treasure Hunt

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

Start Hunting!