Question: combine a for loop and conditional to complete the code Exercise #1: A professor will assign grades to his class as follows: any score more

combine a for loop and conditional to complete the code Exercise \#1:combine a for loop and conditional to complete the code

Exercise \#1: A professor will assign grades to his class as follows: any score more than 15 points above average will receive an A, from 0 - 15 points (inclusive) above average will receive a B, from 0-15 points below average will receive a C, and more than 15 points below average will receive a D. Write a Matlab function called grades.m which will take a single input, which is an array of grades, and return 4 outputs. The first output is the number of A's in the class, the second is the number of B's, the third is the number of C's, and the fourth is the number of D's. As a check, the Matlab commands t=1:140; [A,B,C,D]=grades(75+25cos(t).sin(3t)) should give 20 A's, 57 B's, 38 C's, and 25 D's. (Hopefully the grade distribution at the end of this course will be somewhat better!) Hints: Remember that the Matlab mean command will calculate the average of an array of numbers. You will need a loop with a nested conditional to do the counting

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!