Superimposing a user defined function on a histogram
Mostrar comentarios más antiguos
Here is my attempt where the hist is bar(I,Y) and I want to superimpose Gaussian onto it
Z=[2 3 0 6 0 9 4 0]; N=sum(Z); M=sum(Z(6:8)); m=M; O=sqrt(N); Y=randn(10000,1)*O + m; x=mean(Y); s=std(Y); E=(abs(m-x)/m)*100; PE=(abs(O-s)/O)*100; Y=hist(Y,10000)/10000; Y=Y'; I=linspace(m-3*O,m+3*O,10000); bar(I,Y); hold on plot(I,Gaussian(x,m,O))
Here is the function
function [ gauss e u ] = Gaussian(x,m,O) %This is the Gaussian function % using variables x, m, and o d=1/sqrt(2*pi); e=2*O^2; u=(x-m)^2; gauss=(d*(O^(-1)))^(-u/e);
3 comentarios
Image Analyst
el 23 de Nov. de 2012
Do you have a question?
Chris
el 23 de Nov. de 2012
Chris
el 23 de Nov. de 2012
Respuestas (0)
Categorías
Más información sobre Histograms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!