Answer:
Complete Matlab code along with explanation and output results are given below.
Matlab Code:
clear all
close all
clc
input_grades = input('Enter the grades as elements of a vector ');
len = length(input_grades);
fprintf('There are %.2f grades\n', len);
Mean = mean(input_grades);
fprintf('The Average grade is: %.3f\n', Mean);
STD=std(input_grades);
fprintf('The Standard Deviation is: %.3f\n', STD);
Median = median(input_grades);
fprintf('The Median grade is: %.2f\n', Median);
Output:
Enter the grades as elements of a vector [92,74,53,61,100,42,80,66,71,78,91,85,79,68]
There are 14.00 grades
The Average grade is: 74.286
The Standard Deviation is: 15.760
The Median grade is: 76.00
Explanation:
The user provides input vector of grades
Using the built-in functions of Matlab the length, mean, standard deviation and median of the grades are calculated and printed.
%.2f is a text formatting command that means show up to 2 decimal digits and convert the floating point values to text.
The input vector provided in the question is tested and the program is working correctly.