MATLAB is a programming and data analysis environment for mathematics, engineering and science. A histogram is a type of graph representing the frequency of a certain value or a range of values in a distribution of data. MATLAB contains a builtin function for calculating and graphing histograms from data, but requires a little extra work to display two or more histograms simultaneously on the same axes.

Calculate the data for the first histogram and save it to variables for later use. Use the MATLAB function "hist" as shown:
[counts_1, edges_1] = hist(Y,edges_in);
Where edges_in is a vector of the beginning edges of the bins, or:
[counts_1, edges_1] = hist(Y,nBins);
Where nBins is the number of equally spaced bins in the histogram. If neither edges_in or nBins is given, MATLAB calculates the histogram with 10 bins.

Calculate the data for the second, and any subsequent histograms.

Plot the first histogram using "bar(edges_1,counts_1);"
The appearance of the graph can be customized according to the MATLAB documentation for plotting. Alternatively, using a stairstep graph "stairs(edges_1,counts_1);" may make multiple histograms easier to see on the same graph.

Type the command "hold on" into the MATLAB command window to prevent your current figure from being overwritten by the new graph.

Plot the second and any subsequent histograms, customizing appearance as desired.

Type the command "hold off" to prevent any further drawing from being added to the figure containing your histograms.
Related Searches
References
 Photo Credit Goodshoot/Goodshoot/Getty Images