[英]normalize 2 histogram and plot
我是Matlab的新手,我尝试根据如何在MATLAB中标准化直方图来标准化两个正态分布? ,但我做不到。 有人可以告诉我如何规范以下两个正态分布:
[f,x]=hist(normrnd(25,2.5),50);%# create histogram from a normal distribution.
g=1/sqrt(2*pi)*exp(-0.5*x.^2);%# pdf of the normal distribution
figure(1)
bar(x,f/trapz(x,f));hold on
plot(x,g,'r');hold off
谢谢!
两个建议:
码:
[f,x]=hist(randn(10000,2.5),50);%# create histogram from a normal distribution.
g=1/sqrt(2*pi)*exp(-0.5*x.^2);%# pdf of the normal distribution
figure(1)
bar(x,f/trapz(x,f));hold on
plot(x,g,'r');hold off
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.