Experiment noise data (mnoise) which follow a normal distribution with mean 0 and standard deviation of 0.024
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (2)
Wayne King
am 19 Feb. 2013
Bearbeitet: Wayne King
am 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.
1 Kommentar
Adam
am 20 Feb. 2013
Wayne King
am 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)
1 Kommentar
Adam
am 20 Feb. 2013
Kategorien
Mehr zu Parallel and Cloud finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!