Question

matlab

1. (5 pts) This question requires: matrix manipulation, single for loop, ifelse statement, data input, m script file We have 80 number grades held in a matrix (grad m as you did the gradebook project in es MATLAB lab 1). The letter grades are given by following the rule: A 90).B 80), C P 70), D P 60), F (<60) and S 0): S standards for sick. Write one script file to Give the letter grade to EACH number grade in the matrix Put the letter grades in a 10 x 8 matrix The letter grade matrix should look like: cBBBADCB ACDBACSA BACB BBCA SAC BBCAB DAS BSBBA ABBA ADAB ABAAAABA BBC BAABC


0 0
Add a comment Improve this question Transcribed image text
Answer #1

Matlab code:

clear all;
fprintf('Grade Matrix \n');
matrix = randi([0,100],10,8) %Generate a grade matrix with random values in 0 to 100
Grade = repmat(' ',[10 8]); %intialise letter-grade matrix

for i = 1:10
for j = 1:8
if(matrix(i,j) >= 90)
Grade(i,j) = 'A';
elseif(matrix(i,j) >= 80)
Grade(i,j) = 'B';
elseif(matrix(i,j) >= 70)
Grade(i,j) = 'C';
elseif(matrix(i,j) >= 60)
Grade(i,j) = 'D';
elseif(matrix(i,j) == 0)
Grade(i,j) = 'S';
else
Grade(i,j) = 'F';
end

end
end
fprintf('Letter Grade Matrix \n');
Grade

Sample Output:

Grade Matrix 
matrix =

   96   31   64   67   64   48   60   22
   16   25   38   25   62   31   79   43
   62   11   67   84   98   99    5    6
   59    8   32   73   41   81    8   10
   11   18   92   63   95   12   26   41
   83   66   88   13   64   99   24   50
   66   10    0   69   19   88   71   62
   13   27   42   27   36    0   78   33
   86   86   42   92   46   25   97   88
   87   24   70   90   58   77   55   64

Letter Grade Matrix 
Grade =

AFDDDFDF
FFFFDFCF
DFDBAAFF
FFFCFBFF
FFADAFFF
BDBFDAFF
DFSDFBCD
FFFFFSCF
BBFAFFAB
BFCAFCFD
Add a comment
Know the answer?
Add Answer to:
matlab 1. (5 pts) This question requires: matrix manipulation, single for loop, ifelse statement, data input,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Matlab question Task 2 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following...

    Matlab question Task 2 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following information: 1. Column 1: Student ID 2. Column 2--11: Lab marks (/10) worth 2% each (20% total of final grade) 3. Column 12: Assignment mark (/10) worth 10% of the final grade 4. Column 13: Exam mark (100) worth 70% of the final grade a) Write a function that accepts a student's laboratory, assignment and exam marks as inputs to determine the final mark...

  • Task 5 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following...

    use Matlab to solve this problem, thank you Task 5 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following information: 1. 2, 3, 4, Column 1: Student ID Column 2-11: Lab marks (/10) worth 2% each (20% total of final grade) Column 12: Assignment mark (/10) worth 10% of the final grade Column 13: Exam mark (/100) worth 70% of the final grade a) Write a function that accepts a student's laboratory, assignment and exam marks as...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT