Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write in Matlab program. My Solutions > compute AverageMark In any paricular class in a school, students take multiple subjects. The number of students
Please write in Matlab program.
My Solutions > compute AverageMark In any paricular class in a school, students take multiple subjects. The number of students passing a subject will depend on the threshold passing mark for the particular subject, whose value is dependent on the respective subject. A student is considered pass if their mark is equal to or greater than the passing threshold. The class teacher would like to find the average pass mark of the class, given by,sum of marks for students who passedumber of students who passed and the fraction of students who passed, given by, number of students who passed/ total students in the clas:s Write a function computeAverageMark with the following signature function laverage_mark, frac_passed]-computeAverageMark(m, pass_threshold) nputs: m a vector that contains the marks of students in a class pass_threshold threshold passing mark Output average_mark - average mark of all the students who passed, given by, sum of marks for students who passedumber of students who passed frac passed fraction of students who passed, given by, number of students who passed/ total students in the class If the number of students who passed is zero 0, then the function must return 0 for both the average mark and the fraction of students who passed Note: You are expected to use an appropriate loop to iterate through the vector and compute the required values, rather than using MATLAB built-in functions such as sum, average and vector computations You may assume marks will always be an integer between 0 and 100, inclusive Code to call your function 1 m[0 33 66 80 91 45 49 77 77 82] 2 pass_threshold -50; 3 [average_mark,frac_passed]-computeAverageMark(m, pass_threshold)Step 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