%histogram demo 2
%use Matlab internal function

clear;clc
a=dlmread('ASTR111_003_2007_grad.dat','',2,0);
grad=a(:,2);

%default bin:divide data into 10 bins
%hist(grad)

%specify the number of bins
%hist(grad,20)

%specify the bin; the value indicates the center of the bin
bin=[5:10:95]
freq=hist(grad,bin)
%the return value of hist is the frequency value

xlabel('bin','Fontsize',14)
ylabel('Frequency','Fontsize',14)
title('Histogram','FontSize',18)
legend('Astro Grade','Location','northwest')


