Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Matlab GUI in order to achive following requirements Get 1 0 number of students grade from the user for three different lessons ( Math

Use Matlab GUI in order to achive following requirements
Get 10 number of students grade from the user for three different lessons (Math, Phsc, Music). Attach these grades to a matrice.
Find and Show average grade of each lesson
Find and Show max and min grade for each lesson
Find and Show Standard Deviation of Each Lesson
Find and Show the students id and grade whose grade is greater than average grade of each lesson.
Find and Show the number of students whose grade is greater than average grade of each lesson.
Plot the chart for the average grade of each lesson
Plot the chart for the standard deviation of each lesson
Plot the chart for the number of students whose grade is greater than the average
Plot the chart for the max and min grades for each lesson
Plot the grade values for the Math, Phys and Music lessons for each student and Show all these graphics in one figure.
Plot the grade values of the students for the Math, Phys and Music lessons and Show all these graphics in one figure. (there will be ten number graphics)
I have tried to modify the code but I still can not meet the requirements help please
function gradeAnalyzerGUI
screenSize = get(0, 'ScreenSize');
figWidth =1200;
figHeight =800;
fig = figure('Name', 'Grade Analyzer', ...
'Position', [(screenSize(3)-figWidth)/2,(screenSize(4)-figHeight)/2, figWidth, figHeight],...
'NumberTitle', 'off', ...
'MenuBar', 'none', ...
'ToolBar', 'none');
controlHeight =25;
yOffset = figHeight - controlHeight -10;
yOffset = figHeight -30;
textWidth =140;
editWidth =200;
spacing =20;
uicontrol('Style', 'text', 'String', 'Math Grades:', 'Position', [spacing, yOffset, textWidth, controlHeight]);
mathEdit = uicontrol('Style', 'edit', 'Position', [spacing + textWidth, yOffset, editWidth, controlHeight]);
uicontrol('Style', 'text', 'String', 'Physics Grades:', 'Position', [2*spacing + textWidth + editWidth, yOffset, textWidth, controlHeight]);
physEdit = uicontrol('Style', 'edit', 'Position', [2*spacing +2*textWidth + editWidth, yOffset, editWidth, controlHeight]);
uicontrol('Style', 'text', 'String', 'Music Grades:', 'Position', [3*spacing +2*textWidth +2*editWidth, yOffset, textWidth, controlHeight]);
musicEdit = uicontrol('Style', 'edit', 'Position', [3*spacing +3*textWidth +2*editWidth, yOffset, editWidth, controlHeight]);
calculateButton = uicontrol('Style', 'pushbutton', 'String', 'Calculate', ...
'Position', [4*spacing +3*textWidth +3*editWidth, yOffset, 100, controlHeight],...
'Callback', @calculateButtonCallback);
ax = zeros(1,8);
for i =1:8
row = ceil(i /4);
col = i -(row -1)*4;
ax(i)= subplot(2,4,(row -1)*4+ col);
pos = get(ax(i), 'Position');
set(ax(i), 'Position', [pos(1), pos(2)+0.1, pos(3), pos(4)-0.1]);
end
function calculateButtonCallback(~, ~)
mathGrades = str2num(get(mathEdit, 'String'));
physGrades = str2num(get(physEdit, 'String'));
musicGrades = str2num(get(musicEdit, 'String'));
if length(mathGrades) ~=10|| length(physGrades) ~=10|| length(musicGrades) ~=10
errordlg('Please enter 10 grades for each subject.', 'Input Error');
return;
end
gradesMatrix =[mathGrades; physGrades; musicGrades]';
avgGrades = mean(gradesMatrix);
maxGrades = max(gradesMatrix);
minGrades = min(gradesMatrix);
stdDeviations = std(gradesMatrix);
studentsAboveAvg = sum(gradesMatrix > mean(gradesMatrix));
for i =1:8
axes(ax(i));
cla reset;
end
titles ={'Average Grades', 'Max Grades', 'Min Grades', 'Standard Deviations', 'Students Above Avg', 'Math Grades', 'Physics Grades', 'Music Grades'};
subjects ={'Math', 'Physics', 'Music'};
data ={avgGrades, maxGrades, minGrades, stdDeviations, studentsAboveAvg, gradesMatrix(1, :), gradesMatrix(2, :), gradesMatrix(3, :)};
for i =1:5
axes(ax(i));
bar(data{i});
set(ax(i), 'XTickLabel', subjects, 'XTick', 1:length(subjects));
title(titles{i});
end
studentIDs =1:10;
for i =6:8
axes(ax(i));
plot(studentIDs, data{i},'o-');
xlim([0.5,10.5]);
ylim([0,100]);
set(ax(i), 'XTick', studentIDs);
xlabel('Student ID');
ylabel('Grade');
title([subjects{i-5}' Grades']);
legend(subjects{i-5});
end
end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

=+(f2-tf1) du 0, since the integrand is nonnegative.

Answered: 1 week ago

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago