Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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: 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 countingStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started