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

MATLAB help. So I need to write a code that discusses the BMI of 5 individuals f

ID: 3572289 • Letter: M

Question

MATLAB help.

So I need to write a code that discusses the BMI of 5 individuals from preset arrays. I need it to output their initials from the array which I'm not sure how to do, and I need to use an if statement to output the classification which I can't seem to get to work. Here's a segment of what I have so far that should show my problem.

hFeet=[6 5 5 5 5];
hInches=[2 1 7 10 4];
Weight=[180 150 200 160 105];
Initials=['A.A. B.B. C.C. D.D.'];
a=1;


for x= a:1:5
Height=[(hFeet(x)*12)+hInches(x)];
h(x)=Height;
end


for y= a:1:5
BMI = [703*Weight(y)/(h(y)^2)];
b(y)=BMI;
%fprintf('for %f their BMI is',Initials(1))
if(BMI<18.5)
print('Is underweight')
end
fprintf(' %.1f is the BMI of the person ',BMI )
end

Explanation / Answer

hFeet=[6 5 5 5 5];
hInches=[2 1 7 10 4];
Weight=[180 150 200 160 105];
% use the cell array format
Initials={'A.A.' 'B.B.' 'C.C.' 'D.D.'};
a=1;

for x= a:1:5
Height=[(hFeet(x)*12)+hInches(x)];
h(x)=Height;
end
for y= a:1:5
BMI = [703*Weight(y)/(h(y)^2)];
b(y)=BMI;
%fprintf('for %f their BMI is',Initials(1))
if(BMI<18.5)
print('Is underweight')
end
fprintf(' %.1f is the BMI of the person %s ',BMI,Initials{y} )
end