normal distribution from data
古いコメントを表示
is there a more efficient way to derive a normal distribution.
% Deriving Normal Distribution From the Data
x=0:1:12;
m=mean(Data);
s=std(Data);
p=(1/(s*sqrt(2*pi)))*exp((-(x-m).^2)/(2*s^2));
5 件のコメント
Image Analyst
2013 年 9 月 10 日
Looks pretty efficient to me. Just how much speed do you need? By the way, I assume you know your x is not a normal distribution.
harley
2013 年 9 月 10 日
Image Analyst
2013 年 9 月 10 日
編集済み: Image Analyst
2013 年 9 月 10 日
Just plot it and look at it: plot(x). Does it look like a Gaussian shape to you? No, it's a triangle, so it's a uniform distribution - a box, a flat distribution. You have equal probabilities of having any number. No numbers are more likely than any others - that is unlike what you'd see in a Gaussian Distribution.
Roger Stafford
2013 年 9 月 10 日
Image Analyst, it isn't 'x' that Harley is stating has the normal distribution. It is 'data' which isn't being specified here. The 'x' is the independent variable in the hypothesized normal distribution. A plot of
plot(x,p)
would give the theoretical normal distribution pdf values as functions of x for the mean and std which have been computed from 'data'.
Image Analyst
2013 年 9 月 10 日
You're right - I messed up and thought that x was also the Data.
採用された回答
その他の回答 (2 件)
Shashank Prasanna
2013 年 9 月 10 日
編集済み: Shashank Prasanna
2013 年 9 月 10 日
Since this is normal distribution, the mean and std of the data are the maximum likelihood estimates for the normal distribution from the data.
Once you have the PDF, like you have in the last line of code as 'p', you could plot the PDF using x to span -4*sigma to +4*sigma:
x = -4*s:0.01:4*s
p=(1/(s*sqrt(2*pi)))*exp((-(x-m).^2)/(2*s^2));
plot(x,p)
You could use a wider range if you wanted to.
Roger Stafford
2013 年 9 月 10 日
0 投票
You might try the Statistics Toolbox function 'normplot' to see how closely your 'data' comes to a normal distribution.
カテゴリ
ヘルプ センター および File Exchange で Inverse Gaussian Distribution についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!