Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We are interested in analyzing fitness data for children, we have a vector or st

ID: 3807549 • Letter: W

Question

We are interested in analyzing fitness data for children, we have a vector or student ages, and a second vector of corresponding student push-up counts. Here are two sample vectors you can use, but your code should work for any two vectors of the same length: ages =[14 11 14 13 14 13 12 14 11 11 12 1411 14 11 11 12 12 11 11 14 14 12 12 13 11 11 11 11 14 14 11 12 12 12 12 12 11]; pushUps =[17 29 25 39 10 15 20 25 35 39 11 25 20 21 23 24 32 50 17 21 41 13 22 31 36 71 100 19 20 21 21 23 31 15 18 19 31 32]; Write a single MATLAB statement to create each result. 1a. How many children thirteen and older do we have data for? 1b. Assign the index of the student who did the most push-ups to the variable maxlndex. 1c. What is the average number of push-ups for 11 year olds? 1d. The push-up counts are self-reported and sometimes students exaggerate. Therefore it is best to remove any push-up data that is more than twice the average of the data. Create a vector with that data removed.

Explanation / Answer

%matlab code

ages = [14 11 14 13 14 13 12 14 11 11 12 14 11 14 11 11 12 12 11 11 14 14 12 12 13 11 11 11 11 14 14 11 12 12 12 12 12 11];
pushUps = [17 29 25 39 10 15 20 25 35 39 11 25 20 21 23 24 32 50 17 21 41 13 22 31 22 31 36 71 100 19 20 21 21 23 31 15 18 19 31 32];

older13 = 0;
for i=1:length(ages)
if ages(i) >= 13
older13 = older13 + 1;
end
end
fprintf('Number of Children 13 and older: %d ',older13);
%output: Number of Children 13 and older: 13

maxIndex = 1;
maxPushups = pushUps(1);
for i=1:length(pushUps)
if pushUps(i) >= maxPushups
maxPushups = pushUps(i);
maxIndex = i;
end
end
fprintf('Maximum pushups is of Child %d and pushups is %d ',maxIndex,maxPushups);
%output: Maximum pushups is of Child 29 and pushups is 100

average11 = 0;
count = 0;
for i=1:length(ages)
if ages(i) == 11
average11 = average11 + pushUps(i);
count = count + 1;
end
end
avg = average11/count;
fprintf('Average pushups for 11 year old: %d ',avg);
%output: Average pushups for 11 year old: 34.7143

result = []
j = 1;
for i=1:pushUps(ages)
if (pushUps(i) < 2*avg)
result(j) = pushUps(i);
j = j + 1;
end
end
pushUps = result;
disp(pushUps);
%output: 17 29 25 39 10 15 20 25 35 39 11 25 20 21 23 24 32 50 17 21 41

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote