Matlab Coding for Programming classes

Four weekend Programming classes consist of students with the following numbers: Class I=32 students, Calss II=40 students, Class III=34 students and Class IV=28 students. The distribution of students’ average marks for each class for four (4) tests is given as the followings: Test1 = [76 78 68 82] Test2 = [58 65 70 66] Test3 = [82 84 75 90] Test4 = [77 68 69 75]
For the above distribution, write a single SciLab/Matlab command to determine:
1. Number of students attended the Programming class
2. Total student marks for Test 1
3. Total Test2 mark for Class III
4. Total student Test3 mark for each class
5. Which class has an average mark of Test4 above 70
6. Minimum average mark of Test4

7 Comments

What does your MATLAB code look like so far?
What do you mean? I don’t understand
What @Voss means is that this is obviously a homework assignment, and he is asking to see what you have tried so far.
We are not here to do your homework for you, but if we see some effort on your part, we might try to offer you a hint or two.
Currently I using octave matlab
The numbers given are averages so the total marks involves multiplying the average by the number of students involved.
% Number of students in each class
num_students = [32, 40, 34, 28];
% Test scores for each class
Test_1 = [76, 78, 68, 82];
Test_2 = [58, 65, 70, 66];
Test_3 = [82, 84, 75, 90];
Test_4 = [77, 68, 69, 75];
% Number of students attended the Programming class
total_students = sum(num_students);
% Total student marks for Test 1
total_marks_test1 = sum(Test_1);
% Total Test 2 marks for Class III
total_marks_test2_class3 = Test_2(3) * num_students(3);
% Total student Test 3 marks for each class
total_marks_test3_per_class = Test_3 .* num_students;
% Classes with average marks of Test 4 above 70
avg_marks_test4 = mean(Test_4);
classes_above_70 = find(avg_marks_test4 > 70);
% Minimum average mark of Test 4
min_avg_test4 = min(avg_marks_test4)
min_avg_test4 = 72.2500
@the cyclist I already finish try this coding.. But I dont know how to run it into the common window.
I edited your comment to convert it to executable code. (See the CODE section of the Toolbar? That's how to do it.)
I also removed the last semicolon that suppresses screen output, so you would see it here.
It's unclear to me what your question is at this point.

Sign in to comment.

Answers (0)

Categories

Asked:

on 16 Feb 2024

Commented:

on 16 Feb 2024

Community Treasure Hunt

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

Start Hunting!