function friday13 ( )

%*****************************************************************************80
%
%% friday13() investigates whether the 13th of the month is unlikely.
%
%  Licensing:
%
%    Copyright 2014 The MathWorks, Inc.
%
%  Author:
%
%    Cleve Moler
%
%  Reference:
%
%    Cleve Moler,
%    Experiments with MATLAB
%    https://www.mathworks.com/moler
%
c = zeros(1,7);
for y = 1601:2000
   for m = 1:12
      d = datenum([y,m,13]);
      w = weekday(d);
      c(w) = c(w) + 1;
   end
end
c
bar(c)
axis([0 8 680 690])
avg = 4800/7;
line([0 8], [avg avg],'linewidth',4,'color','black')
set(gca,'xticklabel',{'Su','M','Tu','W','Th','F','Sa'})
title('13th day of the month')

  return
end

