Histograms are widely used in exploratory data analysis. In some applications, such as Monte Carlo simulations, sometimes the data or the distribution manifest with corresponding weights, for example in the analysis of umbrella sampling results. In those situations weights of each data point should be taken into account in constructing histograms out of data points. If you are programming with R, weights package would help you to do this. Recently, I have added small utility function in mathworks file exchange called Generate Weighted Histograms to plot weighted histograms. In this post, I would like to demonstrate how these function can be used. Let's generate some synthetic data, which contains values and corresponding weights and find the weighted histogram.
This trivial example demonstrate the usage of histwc function. One can adjust the bins as the third argument of the function.