Consider the below vector x, which you can copy and paste directly into Matlab. The vector contains the final grades for each student in a large linear algebra course.
x = [61 52 63 58 66 92 64 55 76 60 70 78 76 73 45 63 97 70 100 76 50 64 42 100 67 81 81 59 68 62 72 99 66 76 81 59 47 84 67 75 63 86 73 44 51 69 48 74 61 100 87 55 40 76 88 70 73 93 80 78 75 85 100 57 57 57 57 36 72 83 50 42 60 74 78 89 56 31 69 73 83 73 60 68 43 65 88 60 48 82 86 50 76 65 64 62 40 42 56 69 100 77 85 68 88 100 48 58 87 82 84 62 90 56 97 100 74 73 67 72 81 78 67 53 68 79 69 63 52 76 74 77 59 79 79 69 96 76 79 90 38 54 65 56 89 98 62 70 65 61 84 59 55 83 56 73 73 72 68 64 70 87 72 100 79 66 68 62 52 67 94 55 96 75 72 64 88 80 54 79 72 54 59 93 78 49 64 79 70 76 79 74 75 49 83 61 93 85 69 56 78 74 75 100 47 84 54 42 62 84 89 77 61 82 67 71 91 67 66 71 60 84 76 72 69 80 79 82 91 80 91 81 83 60 63 71 100 81 66 95 97 32 82 82 70 78 64 54 66 83 54 55 81 67 73 79 65 93 68 71 91 89 62 54 53 48 81 60 70 56 60 66 71 62 53 70 94 63 49 68 60 74 72 69 71 74 74 87 77 98 73 79 58 66 100 71 60 63 69 63 64 46 77 81 88 72 68 71 57 56 75 60 85 49 60 72 55 51 56 81 70 77 100 69 69 87 90 72 73 69 33 88 72 71 48 58 72 72 69 81 59 54 56 66 58 82 64 58 67 51 85 74 83 78 64 62 86 81 58 61 79 66 81 64 71 97 73 59 84 90 70 71 88 71 85 42 90 67 81 70 46 68 73 84 82 54 76 46 79 59 58 62 58 67 39 89 44 62 88 61 54 80 69 67 79 62 92 68 59 64 97 82 76 56 44 62 61 67 79 100 60 80 60 47 79 93 70 70 67 77 92 65 59 65 47 82 78 79 76 57 65 79 66 73 68 75 54 48 76 80 58 42 51 57 57 81 63 88 90 75 91 57 69 75 45 83 68 79 93 79 85 70 45 70 38 52 64 64 58 90 61 64 75 42 65 60 66 53 55 90 67 87 70 67 75 77 84 89 64 68 76 66 55 77 79 66 72 77 85 68 82 70 79 66 74 71 100 44 74 81 70 97 61 71 59 49 56 99 54 78 38 77 70 65 73 58 100 68 67 73 65 69 48 74 75 76 62 85 57 83 66 89 51 82 67 60 58 86 53 49 68 70 55 58 68 84 80 55 76 66 70 84 67 61 73 79 70 75 73 100 96 71 82 68 78 63 62 72 75 59 92 63 71 77 83 74 74 75 75 60 97 81 66 67 93 48 75 53 77 73 73 53 72 79 64 73 66 71 58 85 65 64 82 70 74 82 64 80 74 79 63 68 42 52 73 62 55 69 63 78 75 71 77 84 78 84 82 77 59 50 69 77 59 65 38 62 59 82 47 46 41 64 65 67 46 63 62 40 66 62 59 93 62 84 66 60 49 60 80 57 72 94 73 66 50 92 50 69 65 66 52 74 59 61 54 100 60 80 31 76 59 81 81 51 59 83 65 84 98 74 69 77 85 60 62 100 73 78 60 83 67 90 69 67 56 75 83 84 58 74 80 49 67 66 69 54 86 96 57 77 83 86 47 57 44 70 72 42 59 53 67 50 58 56 84 91 77 60 71 51 61 69 82 75 62 84 62 47 48 46 82 62 78 77 77 71 88 52 56 58 75 72 54 100 80 71 61 69 87 77 55 61 73 89 62 89 67 68 76 47 51 72 74 80 81 70 60 72 80 56 81 72 67 88 44 81 58 75 70 75 83 45 67 78 75 71 71 68 56 66 78 93 85 51 56 81 72 71 86 67 64 56 70 52 72 69 57 82 65 56 44 72 72 77 71 58 77 84 75 75 76 67 68 84 72 55 82 76 60 66 90 59 72 42 60 86 77 47 59 66 78]'
(a) What proportion of students failed the course
(i.e., got a mark of less than 50)?
(Note that since the answer is a proportion, it must be between 0
and 1.)
(b) What proportion of students got a B-, B, or B+ (i.e., got a
mark between 70 and 79, inclusive)?
x = [61 52 63 58 66 92 64 55 76 60 70 78 76 73 45 63 97 70 100 76 50 64 42 100 67 81 81 59 68 62 72 99 66 76 81 59 47 84 67 75 63 86 73 44 51 69 48 74 61 100 87 55 40 76 88 70 73 93 80 78 75 85 100 57 57 57 57 36 72 83 50 42 60 74 78 89 56 31 69 73 83 73 60 68 43 65 88 60 48 82 86 50 76 65 64 62 40 42 56 69 100 77 85 68 88 100 48 58 87 82 84 62 90 56 97 100 74 73 67 72 81 78 67 53 68 79 69 63 52 76 74 77 59 79 79 69 96 76 79 90 38 54 65 56 89 98 62 70 65 61 84 59 55 83 56 73 73 72 68 64 70 87 72 100 79 66 68 62 52 67 94 55 96 75 72 64 88 80 54 79 72 54 59 93 78 49 64 79 70 76 79 74 75 49 83 61 93 85 69 56 78 74 75 100 47 84 54 42 62 84 89 77 61 82 67 71 91 67 66 71 60 84 76 72 69 80 79 82 91 80 91 81 83 60 63 71 100 81 66 95 97 32 82 82 70 78 64 54 66 83 54 55 81 67 73 79 65 93 68 71 91 89 62 54 53 48 81 60 70 56 60 66 71 62 53 70 94 63 49 68 60 74 72 69 71 74 74 87 77 98 73 79 58 66 100 71 60 63 69 63 64 46 77 81 88 72 68 71 57 56 75 60 85 49 60 72 55 51 56 81 70 77 100 69 69 87 90 72 73 69 33 88 72 71 48 58 72 72 69 81 59 54 56 66 58 82 64 58 67 51 85 74 83 78 64 62 86 81 58 61 79 66 81 64 71 97 73 59 84 90 70 71 88 71 85 42 90 67 81 70 46 68 73 84 82 54 76 46 79 59 58 62 58 67 39 89 44 62 88 61 54 80 69 67 79 62 92 68 59 64 97 82 76 56 44 62 61 67 79 100 60 80 60 47 79 93 70 70 67 77 92 65 59 65 47 82 78 79 76 57 65 79 66 73 68 75 54 48 76 80 58 42 51 57 57 81 63 88 90 75 91 57 69 75 45 83 68 79 93 79 85 70 45 70 38 52 64 64 58 90 61 64 75 42 65 60 66 53 55 90 67 87 70 67 75 77 84 89 64 68 76 66 55 77 79 66 72 77 85 68 82 70 79 66 74 71 100 44 74 81 70 97 61 71 59 49 56 99 54 78 38 77 70 65 73 58 100 68 67 73 65 69 48 74 75 76 62 85 57 83 66 89 51 82 67 60 58 86 53 49 68 70 55 58 68 84 80 55 76 66 70 84 67 61 73 79 70 75 73 100 96 71 82 68 78 63 62 72 75 59 92 63 71 77 83 74 74 75 75 60 97 81 66 67 93 48 75 53 77 73 73 53 72 79 64 73 66 71 58 85 65 64 82 70 74 82 64 80 74 79 63 68 42 52 73 62 55 69 63 78 75 71 77 84 78 84 82 77 59 50 69 77 59 65 38 62 59 82 47 46 41 64 65 67 46 63 62 40 66 62 59 93 62 84 66 60 49 60 80 57 72 94 73 66 50 92 50 69 65 66 52 74 59 61 54 100 60 80 31 76 59 81 81 51 59 83 65 84 98 74 69 77 85 60 62 100 73 78 60 83 67 90 69 67 56 75 83 84 58 74 80 49 67 66 69 54 86 96 57 77 83 86 47 57 44 70 72 42 59 53 67 50 58 56 84 91 77 60 71 51 61 69 82 75 62 84 62 47 48 46 82 62 78 77 77 71 88 52 56 58 75 72 54 100 80 71 61 69 87 77 55 61 73 89 62 89 67 68 76 47 51 72 74 80 81 70 60 72 80 56 81 72 67 88 44 81 58 75 70 75 83 45 67 78 75 71 71 68 56 66 78 93 85 51 56 81 72 71 86 67 64 56 70 52 72 69 57 82 65 56 44 72 72 77 71 58 77 84 75 75 76 67 68 84 72 55 82 76 60 66 90 59 72 42 60 86 77 47 59 66 78];
count = 0; % number of failed students
totalcount = 0; %total students count
gotb = 0; %total students who got b or b- or b+ ie 70 to 79 inclusive
for a = x
totalcount = totalcount+1;
if a<50
count=count+1;
end
if a>=70 && a<=79
gotb = gotb+1;
end
end
proportion = count/totalcount; %proportion of students
disp(proportion);
disp(gotb); % number of students who got the required marks
I have written a well commented code for better understanding
Screenshot output:
Get Answers For Free
Most questions answered within 1 hours.