MATLAB: How to bin a set of data probability and plot it as a bar chart

bar chartbin datahistogramnormal distributionpdfprobability density

I have a set of observed data of 3 years of hourly measurements "x" (25920×1 double) with min = 0.00003484 and max = 3.8787 ;
I want to plot a figure that has the following characteristics:
1. x axis = x values, y axis = probability density
2. X should be binned for one month and plotted as a bar chart (look like a bar chart)
3. A normal pdf (based on the mean and std of the observed data) must be plotted
This is in order to compare the existing data and a normal dist or how well the fit in the graph.
I don't even know how to start, how can I do this? Any idea? I am having trouble binning the data and plotting it as a bar chart of the pdf. The normal pdf plotting is not an issue

Best Answer

If you have the Statistic and Machine Learning Toolbox, you could use the histfit command.