Experiment noise data (mnoise) which follow a normal distribution with mean 0 and standard deviation of 0.024
이전 댓글 표시
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.
채택된 답변
추가 답변 (2개)
Wayne King
2013년 2월 19일
편집: Wayne King
2013년 2월 19일
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
2013년 2월 20일
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)
카테고리
도움말 센터 및 File Exchange에서 Parallel and Cloud에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!