Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a MATLAB program in a script file that calculate the average, standard dev

ID: 3573712 • Letter: W

Question

Write a MATLAB program in a script file that calculate the average, standard deviation, and median of a list of grades as well as the number of grades on the list. The program asks the user (input command) to enter the grades as elements of a vector. The program then calculates the required quantities using MATLAB's built-in functions length, mean, std, and median. The results are displayed in the Command Window in the following format: "There are XX grades." where XX is the numerical value. "The average grade is XX." where XX is the numerical value. "The standard deviation is XX." where XX is the numerical value. "The median grade is XX." where XX is the numerical value. Execute the program and enter the following grades: 92, 74, 53, 61, 100, 42, 80, 66, 71, 78, 91, 85, 79, and 68.

Explanation / Answer

Matlab code:

clear, clc

grades = input('grades as a vector: ');

num = length(grades);

average = mean(grades);

standard_deviation = std(grades);

m = median(grades);

fprintf(' There are %i grades. ' , num)

fprintf(' The average grade is %.1f. ' , average)

fprintf('Standard Deviation is %.1f. ', standard_deviation)

fprintf('Median grade is %.1f. ',m)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote