Can anybody help me with the two questions below in the image? Thanks in advance

1 vue (au cours des 30 derniers jours)
Alaa Mohammed
Alaa Mohammed le 12 Mai 2021
Modifié(e) : Adam Danz le 19 Mai 2021
  2 commentaires
Adam Danz
Adam Danz le 12 Mai 2021
What have you tried so far?
Alaa Mohammed
Alaa Mohammed le 12 Mai 2021
This is my answer for the first question, the second I can't solve it

Connectez-vous pour commenter.

Réponses (3)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 13 Mai 2021
% Simple and easy answer here is to use logical indexing and categorical array approaches along with table, e.g.:
ID = (1:10)';
ALL=[ID, PE EM PS]; % This is your predefined/already entered table of student grades.
EX2 = array2table(ALL,'VariableNames', {'ID', 'P_E', 'E_M', 'P_S'}); %Given data table. You can change table headers if needed.
CC = cell(size(ALL(:,2:4)));
CC(ALL(:,2:4)>90)={'A'};
CC(ALL(:,2:4)<=90 & ALL(:,2:4)>80)={'B'}
CC(ALL(:,2:4)<=80 & ALL(:,2:4)>70)={'C'}
CC(ALL(:,2:4)<=70 & ALL(:,2:4)>60)={'D'}
CC(ALL(:,2:4)<=60)={'F'}
CC = categorical(CC);
PE = CC(:,1);
EM = CC(:,2);
PS = CC(:,3);
TT = table(ID, PE, EM, PS)
Num_C = sum(CC=='C', 'all')
fprintf('# of low graded students are %d \n', Num_C)
%% Good luck
  3 commentaires
Image Analyst
Image Analyst le 15 Mai 2021
For Exercise 2A, your counts of 3 for the As and Fs are correct. The exercise is missing the counts for the other grades so you need to add that in.

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 13 Mai 2021
You can either do this by doing a series of comparisons like
numCs = sum(grades > 70 & grades <= 80) % Compute the number of "C" grades.
or you can specify the edges and pass the edges into histogram() or histcounts().
You forgot to show us the way you did it, so we cannot correct your code for you.

DGM
DGM le 13 Mai 2021
Modifié(e) : DGM le 13 Mai 2021
Consider this partial solution for part 2 using some simplifications based on the binning and a basic lookup table. This could be made more robust, but let's just be simple for now.
% make some random test grades
G = randi(40,10,3)+60
sn = 1:10;
examnames = {'basket weaving','daisy picking','alligator wrestling'};
lut = {'F','F','F','F','F','F','D','C','B','A'};
bin = ceil(G/10);
gradeletter = lut(bin);
table(sn',[gradeletter{:,1}]',[gradeletter{:,2}]',[gradeletter{:,3}]', ...
'variablenames',['student id',examnames])
gives
ans =
10×4 table
student id basket weaving daisy picking alligator wrestling
__________ ______________ _____________ ___________________
1 C D A
2 D B C
3 D C A
4 A B A
5 A C B
6 D A D
7 B A A
8 B A A
9 D A B
10 D D B
"Find the number of students with minimum grades" sounds awfully vague do me. Does that mean "minimum passing grade" (i.e. D) or "minimum valid grade" (i.e. F)?
  2 commentaires
Alaa Mohammed
Alaa Mohammed le 19 Mai 2021
F F F or F F D or F D D not D D D
Adam Danz
Adam Danz le 19 Mai 2021
Modifié(e) : Adam Danz le 19 Mai 2021
What is that mean?
Why don't you try to implement those grades into one of the solutions here?
I really don't think this forum shouldn't be used to do people's homework but that's just my opinion.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by