Issues with randn function in matlab

I am using matlab's randn function to generate random random numbers from a standard normal distribution. I could see this example in the help

r = 1 + 2.*randn(100,1);

It says that it draws numbers from the normal distribution with mean 1 and standard deviation 2. However, when I calculate the mean of r. It is around 0.77. So I am a bit confused. Can anyone please explain?


The arithmetic mean (sample mean) will converge to the actual mean of the distribution as the number of samples approaches infinity. However, for any finite number of samples, you're not guaranteed to get the actual mean of the distribution (i.e., 1.0.)


   r = 1 + 2.*randn(100,1);  mean(r)
   r = 1 + 2.*randn(1000,1);  mean(r)
   r = 1 + 2.*randn(10000,1);  mean(r)
   r = 1 + 2.*randn(100000,1);  mean(r)

etc. and see what happens.

Need Your Help

What would kernel do when another hardware interrupt got up, while handling an interrupt


When kernel is handling an interrupt, what would it do if hardware raised another interrupt request, simple drop it ? Or would that behavior be harmful ?

Datadriven framework ->reading from .ods file

selenium webdriver selenium-webdriver testng

TestNG has built in support for DATADRIVEN framework. I implemented datadriven framework by reading data from excel file using jxl api. But now I want to read data from a .ods format file (OpenSour...