Histogram:
The histogram is a particular type of bar chart which shows the frequency of occurrence of the values within a vector. The Histograms use what are known as bins to collect values which are in given ranges. The MATLAB has a function to generate a histogram, hist. Calling the function with the form hist(vec) by default take the values in the vector vec and place them into 10 bins (or, hist(vec,n) will place them in n bins) and plots this, which is as shown in figure.
>> vec = randint(1,12,[1 10])
vec =
10 8 2 5 10 10 5 9 1 4 9 1
>> hist(vec)
In this illustration, the numbers range from 1 to 10 in the vector, therefore there are 10 bins in the range from 1 to 10. The heights of the bins present the number of values which fall within that specific bin. The hist function really returns values; the first returned is a vector showing how many of the values from the original vector fall in each of the bins:
>> c = hist(vec)
c =
2 1 0 1 2 0 0 1 2 3
The bins in a histogram are not essentially all of similar width. The Histograms are used for statistical analyses on data.