Experiment noise data (mnoise) which follow a normal distribution with mean 0 and standard deviation of 0.024
Show older comments
I am generating 251 experiment noise data (mnoise) which follow a normal distribution with mean 0 and standard deviation of 0.024. And I have to use 'rand' command.
I know how to generate random numbers using rand command. But I don't know how to generate noise data that follows mean=0.5 and sd=0.024. I have been using
Y = normpdf(X,mu,sigma) function.
I also know that normal distribution is a bell shape plot that is based on mean and sd. Please help. Any tips would be very helpful.
Accepted Answer
More Answers (2)
Wayne King
on 19 Feb 2013
Edited: Wayne King
on 19 Feb 2013
You have to distinguish between generating random numbers (data) from some distribution and the probability density function. There is nothing about the probability density function that is random. So which do you want?
x=0.5+0.024*randn(251,1);
hist(x)
Do you see the shape resembling a normal distribution from the above histogram?
Your original post said you wanted to generate data that follows a N(0.0.024^2) distribution that is exactly what the command I gave you does.
You can also generate the PDF for that distribution, but again, those are not the same things.
Wayne King
on 20 Feb 2013
If you have the Statistics Toolbox, then
x = -0.1:1e-4:0.1;
y = normpdf(x,0,0.024);
plot(x,y)
If not
x = -0.1:1e-4:0.1;
sd = 0.024;
y = 1/sqrt(2*pi*sd^2).*exp(-x.^2/(2*sd^2));
plot(x,y)
Categories
Find more on Noncentral t Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!