I’m trying to figure out the difference between histograms made on Matlab (using the function ‘hist’ and ‘histc” and one made on excel2007.
The following is my data:
92.75408677
94.30203471
39.29203084
39.69600648
169.599791
47.69892422
55.70547521
45.68462703
47.87167045
40.44786332
166.2861124
113.4816594
100.4448781
47.82555238
I use the following bins
0
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
Here are the results of the different frequencies using the different softwares and different functions:
bins Histc-Matlab Excel Hist-Matlab
0 0 0 0
10 0 0 0
20 0 0 0
30 2 0 0
40 5 2 3
50 1 5 4
60 0 1 1
70 0 0 0
80 0 0 0
90 2 0 2
100 1 2 1
110 1 1 1
120 0 1 0
130 0 0 0
140 0 0 0
150 0 0 0
160 2 0 0
170 0 2 2
180 0 0 0
I’m confused why are they all different? Can anyone explain me that?
Cheers
Just info from manuals:
n = hist(Y,x) where x is a vector, returns the distribution of Y among length(x) bins with centers specified by x.
n = histc(x,edges) counts the number of values in vector x that fall between the elements in the edges vector (which must contain monotonically non-decreasing values). n is a length(edges) vector containing these counts. n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1). The last bin counts any values of x that match edges(end).
Excel counts the number of data points in each data bin. A data point is included in a particular data bin if the number is greater than the lowest bound and equal to or less than the greater bound for the data bin.