write a matlab 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
1.) Horizontal Bar
Matlab code:
clear all
y = [5,15,20,5,3,2];
ax = gca;
barh(y,0.5,'b')
xlabel('Number of student');
ylabel('Grade');
title('Class Report');
ax.YTickLabel = ({'A','B','C','D','E','F'});
Output:
2.) Pie
Matlab code:
clear all
y = [5,15,20,5,3,2];
labels = {'A','B','C','D','E','F'};
pie(y,labels)
title('Class Report');
Output:
3.) Histogram
Matlab code:
clear all
y = [5,15,20,5,3,2];
ax = gca;
bar(y,0.5,'b')
xlabel('Grade');
ylabel('Number of student');
title('Class Report');
ax.XTickLabel = ({'A','B','C','D','E','F'});
Output:
Comments
Leave a comment