% file "grade.m": display and analysis of grades % INPUT "noname" % FIRST two rows are same, contain types of assignments. % ASSUMPTIONS: EACH hw, test and final graded on maxscore 100, % EACH quiz graded on 10. % Nonexistent grades filled out with 0's % % Due to replacement of worst 3 hw grades % and quiz grades by maxgrade, program % is MEANINGLESS until 3rd quiz/hw % % % OUTPUT two graphs and a lettergrade file % ENVIRONMENT Matlab on xterm % USAGE: type "matlab" % % type "grade" % clear all; clf; 'USAGE: save the NUMERIC data of the file "noname" into a file with the SAME NAME before running this program' id = input('type your code or ssn > '); fileone = sprintf('noname'); grade_names = ['A '; 'B+'; 'B '; 'C+'; 'C '; 'D '; 'F ']; % assign distribution of grades ``final class position < % (0.20*classsize) gets A'' etc.. distr = [.2, .35, .50, .65, .80, .90, 1.0]; % read grades and types of grades assgn = ['h';'m';'f';'e']; eval(['load ', fileone]); [rows, cols] = size(noname); students = rows-2; % first two rows are other info, first row is %assignment type info rawgrades = noname(1:rows,:); type = [rawgrades(1,1:cols)]; %4 rough types of grades hw,midterm,final,extracredit; % find column indices %in rawgrades for each type hwcolid= find(type(1,:) == 1); midcolid= find(type(1,:) == 2); finalcolid= find(type(1,:) == 3); extcolid= find(type(1,:) == 4); %group types of grades--remember rawhw etc. will not have first 2 rows %of rawgrades; and one fewer col: no student id attached to rawhw if length(hwcolid) ==0 rawhw(1:students,1) = 0 else for i = 1:length(hwcolid) temp_rawhw(1:students, i) = rawgrades(3:rows,hwcolid(i))/8; end; rawhw(1:students,1) = temp_rawhw*ones(length(hwcolid),1); end; if length(midcolid) ==0 rawmid(1:students,1) = 0; else rawmid(1:students,1) = rawgrades(3:rows,midcolid(1))/10; end; if length(finalcolid)==0 rawfinal(1:students,1) =0; else rawfinal(1:students,1) = rawgrades(3:rows,finalcolid(1))*7/(10*6); end; if length(extcolid)==0 rawext(1:students,1) =0; else for i = 1:length(extcolid) temp_rawext(1:students, i) = rawgrades(3:rows,extcolid(i))/13; end; rawext(1:students,1) = temp_rawext*ones(length(extcolid),1); %rawext(1:students,1) = rawgrades(3:rows,extcolid(1))*15/(10*18); end; % scores by category and total score temp_score= [rawhw,rawmid,rawfinal]; score = sum(temp_score')'; full_score = [rawhw,rawmid,rawfinal,rawext]; %Find medians (performance of B/C+ student) for all categories. full_med= median(full_score); %============================================== % compare to average performance on the categories idx = find(rawgrades(:,1) == id); % that is not the index for temp_score subplot(1,2,2); title('relative performance'); hold on; plot(full_med, ':'); my_scores = full_score(idx-2,:); plot(my_scores); xlabel('-- student, ... median'); %xlabel('student--solid line, median..dotted line'); for i=1:length(full_med), text(i,full_med(i)+.025,assgn(i,:)); end; hold off; %ranking [score_dist, ranking_idx] = sort(score); %Plot distribution of scores subplot(1,2,1); plot(score_dist); hold on; str = sprintf('COT4501-fall2000: rough grade indicator for %d', id); title(str); xlabel('ranking of students'); ylabel('score'); % display grade distribution (create grade-lines) for grd = 1 : length(distr), y = distr(grd); plot(floor(students*(1-y)), [1:max(score)],'.'); text(floor(students*(1-y)),1,grade_names(grd,:)); end; plot(0,max(score),'.'); plot(0,0,'.'); % id's grade after adding weighted extra credits sort_idx = find(score(idx-2) == score_dist); %to get right index for score, subtract 2, since score % is missing first 2 rows of rawgrades % here's where you add on the extra credits plot(sort_idx(1), score(idx-2)+rawext(idx-2), 'o'); hold off; %print in file, ranking of students and grades fid = fopen('ltrgrd','w'); padded_distr = [1,ceil(distr.*students)]; for i=1:length(distr), ii=[padded_distr(i): padded_distr(i+1)]; fprintf(fid,'%s \n', grade_names(i,:)); stud = rawgrades(ranking_idx(students-ii+1)+2,1); %again +2 necessary because the actual students and % rawgrades only start at row3 %unlike in score, scaled_score etc.. fprintf(fid,'\t%8d\n', stud); clear stud; end;