Answer to Question #201121 in MatLAB for Abuhuraira

Question #201121

Matlab Software: Matlab Copy the data from the excel sheet. Write a program that grade up the data values according to grading criteria given below. Then make the following graphs to show the number of students that got each grade 1. Horizontal Bar 2. Pie 3. Histogram Note: Label each graph so that it would easily be understandable. Marks range Grade x 84.5 A + 79.5 x


1
Expert's answer
2021-05-31T23:55:21-0400
clc;
clear all;
%%
T = readtable('Data.xlsx');
A = table2array( T );
%%
marks(1,1)="x>84.5";
marks(1,2)="A+";
marks(2,1)="79.5<x<84.5";
marks(2,2)="A";
marks(3,1)="74.5<x<79.5";
marks(3,2)="B+";
marks(4,1)="69.5<x<74.5";
marks(4,2)="B";
marks(5,1)="64.5<x<69.5";
marks(5,2)="B-";
marks(6,1)="59.5<x<64.5";
marks(6,2)="C+";
marks(7,1)="54.5<x<59.5";
marks(7,2)="C";
marks(8,1)="49.5<x<54.5";
marks(8,2)="D";
marks(9,1)="x<49.5";
marks(9,2)="F";
marks(1,3)=0;
marks(2,3)=0;
marks(3,3)=0;
marks(4,3)=0;
marks(5,3)=0;
marks(6,3)=0;
marks(7,3)=0;
marks(8,3)=0;
marks(9,3)=0;
%%
for i = 1:size(A,1)
    for j = 1:size(A,2)
        if(A(i,j)>=84.5)
            marks(1,3)=str2num(marks(1,3))+1;
        elseif(A(i,j)<84.5 && A(i,j)>=79.5)
            marks(2,3)=str2num(marks(2,3))+1;
        elseif(A(i,j)<79.5 && A(i,j)>=74.5)
            marks(3,3)=str2num(marks(3,3))+1;
        elseif(A(i,j)<74.5 && A(i,j)>=69.5)
            marks(4,3)=str2num(marks(4,3))+1;
        elseif(A(i,j)<69.5 && A(i,j)>=64.5)
            marks(5,3)=str2num(marks(5,3))+1;
        elseif(A(i,j)<64.5 && A(i,j)>=59.5)
            marks(6,3)=str2num(marks(6,3))+1;
        elseif(A(i,j)<59.5 && A(i,j)>=54.5)
            marks(7,3)=str2num(marks(7,3))+1;
        elseif(A(i,j)<54.5 && A(i,j)>=49.5)
            marks(8,3)=str2num(marks(8,3))+1;
        else
            marks(9,3)=str2num(marks(9,3))+1;
        end
    end
end
%%
figure;
barh(str2double(marks(:,3)));
yticklabels(['A+','A',"B+","B","B-","C+","C","D","F"]);
ylabel('Grades');
xlabel('Number of Students');
title('Bar Graph');
%%
figure;
labels={'A+','A',"B+","B","B-","C+","C","D","F"};
pie(str2double(marks(:,3)));
lgd = legend(labels);
title('Pie graph');
%%
bins=[0 49.5 54.5 59.5 64.5 69.5 74.5 79.5 84.5 100];
figure;
histogram(A,bins);
xlabel('Lower value of interval');
ylabel('Frequency');
title('Histogram');

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS