Vector Function to calculate grades

I need a MATLAB function that will output a vector which is derived from a matrix of grades in a course.
The maxtrix is as follows:
10 6 8 10 18 30
9 8 12 9 16 35
7 10 9 7 9 41
Each row represents one student. The first four numbers in a row represent assignment grades out of 10. You must take the top 3 out of 4 grades on the assignment. The fifth number represents the midterm grade which is out of 20 and the last number represents the final exam grade out of 50. The assignments are worth 30% of the grade, the midterm is worth 20 % and the final is worth 50%. I need a vector that will out the grades of these 3 students.

1 Comment

It seems to me that you defines max points to reflect these percents that you provide in the end already..?

Sign in to comment.

 Accepted Answer

Cedric
Cedric on 6 Apr 2013
Edited: Cedric on 6 Apr 2013
Assuming that my comment above is valid and that the full matrix of point is P, you can get the sum of points per student as follows:
>> P % All points.
P =
10 6 8 10 18 30
9 8 12 9 16 35
7 10 9 7 9 41
>> HW = sort(P(:,1:4), 2) % Sorted homework.
HW =
6 8 10 10
8 9 9 12
7 7 9 10
>> Ps = [HW(:,2:end), P(:,5:6)] % Selection of 3 best HW, MT, final.
Ps =
8 10 10 18 30
9 9 12 16 35
7 9 10 9 41
>> sum(Ps, 2) % Total points per student (max=100).
ans =
76
81
76
Then you can do whatever is needed to rescale to relevant grades, e.g. divide by 100, multiply by 6 (?), etc.

More Answers (0)

Categories

Tags

Asked:

on 6 Apr 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!