If you have version R2014b or later, you can use the histogram command, and specify the 'Normalization' property to be 'probability':
rng default x = randn(1000,1); h = histogram(x,'Normalization','probability');
h.Values will give you the density.
If you have version R2014b or later, you can use the histogram command, and specify the 'Normalization' property to be 'probability':
rng default x = randn(1000,1); h = histogram(x,'Normalization','probability');
h.Values will give you the density.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!