%Spring 2001, TAM 202 Prelim 1 and 2 scores, Final exam scores, and 
%  Grand Numerical Sum Scores (on which letter grades are based)
%Run this MATLAB file to get histograms and stats.
%  -A. Ruina   5/27/2001
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Prelim 1 scores
A=[97 72 78 94 80 98 100 100 95 96 96 91 84 93 62 93 91 94 93 93 ...
87 100 91 89 55 43 57 96 96 47 88 88 93 90 86.5 94 85 80 85 69 ...
89 84 70 89 85 84 66 86 70 58 86 81 69 81 73 87 76 70 90 84 65 ...
82 87 57 69  67 64 51 78 67.5 64 73 90 55 70 66 71.5 68 77 ...
23 19 60 49 94 46 66];


%prelim 2 scores
B=[104 103 101 100 98 98 96 96 96 93 90 90 90 90 88 87 87 86 86 81 ...
81 80 80 79 78 78 78 77 77 76 75 75 75 75 74 74 73 73 73 72 72 ...
72 72 71 71 71 80 70 70 70 69 69 68 67 66 66 66 65 65 65 65 64 ...
63 63 63 63 62 61 61 61 60 59 59 59 59 59 58 57 56 56 56 55 54 ...
52 49 48 46];

%Final exam scores
C=[89 98 91 93 97 86 86 82 87 98 89 87 92 80 81 87 94 90 84 86 84 ...
85 78 79 84 87 79 71 77 78 76 80 78 80 79 78 74 77 69 75 69 76 ...
82 75 82 76 85 79 83 89 76 85 79 73 75 83 79 72 58 73 74 69 56 ...
76 73 80 67 80 59 68 76 63 67 41 77 57 53 76 67 63 72 41 69 43 24];

%Total grade (final grade is based on this number)
D=[94.63648649 93.72554859 93.193764 93.11780056 93.09197694 ...
92.93725536 92.4525974 92.26896552 91.89874185 91.73313141 ...
90.82624605 90.28608284 90.2447828 90.19844682 90.16767801 ...
89.67996272 89.32699193 89.03762815 88.48805721 88.01435592 ...
87.95207363 87.875 87.82277115 87.81541648 87.3729064 ...
85.78363189 85.35135468 85.20157073 84.47851878 83.9984438 ...
83.98588101 83.67870457 83.53427307 83.51817335 83.49340997 ...
83.0278431 82.85176645 82.76219212 82.75641514 82.5082023 ...
82.25705965 82.02904948 81.91955422 81.89585275 81.19027966 ...
80.81031124 80.52636272 79.96076323 79.84585292 78.9682378 ...
78.84871855 78.64790036 78.08804001 77.99100381 77.52337463 ...
77.37564058 76.84187359 76.80754123 76.63915409 76.61865987 ...
76.37012921 76.10985826 75.77466655 75.65658954 75.6403421 ...
75.28250759 74.61735718 73.52765634 73.02376532 72.38210922 ...
72.26646505 72.22351838 71.15997149 69.95438024 69.72661367 ...
68.66828204 66.39774902 65.51490374 65.1170591 64.88972393 ...
63.12657819 58.94166455 56.34260881 55.65473732 52.60556068 ...
52.30564792];


fprintf('\n\n**************************************************************************\n')
fprintf('               GRADE  STATISTICS, TAM 202, SPRING 2001 \n')
fprintf('               --------------------------------------- \n ')
fprintf('                                Prel I   Prel 2    Final ex  TOTAL\n')
fprintf('Number of students          = %8i %8i %8i %8i\n',...
          [length(A) length(B) length(C) length(D)])
fprintf('Number with scores of 100+  = %8i %8i %8i %8i\n',... 
          [sum(A>=100) sum(B>=100) sum(C>=100) sum(D>=100)])
fprintf('Number  above 90            = %8i %8i %8i %8i\n',... 
          [sum(A>90) sum(B>90) sum(C>90) sum(D>90)])
fprintf('Number less than 60         = %8i %8i %8i %8i\n',... 
          [sum(A<60) sum(B<60) sum(C<60) sum(D<60)])
fprintf('Mean                        = %8.1f %8.1f %8.1f %8.1f \n',... 
          [mean(A) mean(B) mean(C) mean(D)])
fprintf('Median                      = %8.0f %8.0f %8.0f %8.0f \n', ...
          [median(A) median(B) median(C) median(D)])
fprintf('Sandard dev                 = %8.1f %8.1f %8.1f %8.1f \n',...
          [std(A) std(B) std(C) std(D)])
fprintf('**************************************************************************\n')
fprintf('                   (See Figure windows for histograms)                  \n')
fprintf('      (Do more calculations with the matrices  A,B,C,D if you want.)      \n')

figure(1)
subplot(2,1,1)
A=sort(A);
i=1:length(A);
plot(A,i)
xlabel('Score on Prelim 1');  ylabel('# students with at least that score')
title('Prelim 1 cumulative  distribution')
axis([50 100 0 120])

subplot(2,1,2)
hist(A, 2.5 + 5*[0:19])
xlabel('Score on Prelim 1');  ylabel('# students (in 5 point bins)')
title('Prelim 1  distribution')
axis([50 100 0 25])

figure(2)
subplot(2,1,1)
B=sort(B);
i=1:length(B);
plot(B,i)
xlabel('Score on Prelim 2');  ylabel('# students with at least that score')
title('Prelim 2 cumulative  distribution')
axis([50 100 0 120])

subplot(2,1,2)
hist(B, 2.5 + 5*[0:19])
xlabel('Score on Prelim 2');  ylabel('# students (in 5 point bins)')
title('Prelim 2  distribution')
axis([50 100 0 25])

figure(3)
subplot(2,1,1)
C=sort(C);
i=1:length(C);
plot(C,i)
xlabel('Score on Final ex');  ylabel('# students with at least that score')
title('Final ex cumulative  distribution')
axis([50 100 0 120])

subplot(2,1,2)
hist(C, 2.5 + 5*[0:19])
xlabel('Score on Final ex');  ylabel('# students (in 5 point bins)')
title('Final exam  distribution')
axis([50 100 0 25])


figure(4)
subplot(2,1,1)
D=sort(D);
i=1:length(D);
plot(D,i)
xlabel('Total course score');  ylabel('# students with at least that score')
title('Total score cumulative  distribution')
axis([50 100 0 120])

subplot(2,1,2)
hist(D, 2.5 + 5*[0:19])
xlabel('Total score');  ylabel('# students (in 5 point bins)')
title('Total score  distribution')
axis([50 100 0 25])


figure(5)

D=sort(D);
i=1:length(D);
plot(D,i)
xlabel('Total course score');  ylabel('# students with at least that score')
title('Total score cumulative  distribution')
axis([50 100 0 120])
grid on



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
