histogram normalized in matlab

To create a normalized histogram in Matlab, you can use the histogram function with the 'Normalization' parameter set to 'probability'.

Here's an example:

main.m
% Generate some sample data
data = randn(1000, 1);

% Create a normalized histogram with 20 bins
histogram(data, 20, 'Normalization', 'probability')
149 chars
6 lines

This will create a histogram with 20 bins, where the y-axis represents the probability density. Note that the sum of the areas of all bars will be equal to 1, which represents the total probability of the data set.

related categories

gistlibby LogSnag