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

MATLAB 5 - BMI & Weight Status ody mass index (BMI) is a measure of body fat bas

ID: 1767416 • Letter: M

Question

MATLAB 5 - BMI & Weight Status ody mass index (BMI) is a measure of body fat based on height and weight screening tool to identify possible weight problems for adults. However, BMI is not a diagnostic tool. The standard weight status categories associated with BMI ranges for adults are shown in the following table. [1] both adult men and It is used as a Table 1. Weight Status Categories ght Status Below 18.5 18.5-24.9 250-299 30.0 and Above Obese ht Write a MATLAB custom function to calculate BMI and determine the weight status category. Calculate BMI by dividing weight in pounds (Ibs) by height in inches (in) squared and multiplying by a conversion factor of 703. You should use conditional statements in your function to determine the appropriate weight status category. Your program should display the calculated BMI value and display the weight status category The input arguments should be height and weight. The output arguments should be BMI and weight status. Weight status should be saved as a character array and assigned the appropriate wieght status as shown in Table 1, using exact spelling and case (i.e., assign the character string 'Normal' to your output variable for weight status). Test your function using the following values of height (inches) and weight (lbs) height 68 in, weights 110 lbs height : 74 in, weight = 180 lbs height 61 in, weight 150 lbs height: 64 in, weight 200 lbs 11] Centers for Disease Control and on, b BMlabout adult BMIhtm, accessed March 19, 2018. Your Function Reset MATLAB Documentation 1 Custom function to calculate BMI given height and weight function [BMI, Status] CalculateBMI(h, w)

Explanation / Answer

MATLAB CODE:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function BMI=calculateBMI(h,w)
BMI=703*(w/h^2)
if BMI<=18.5
disp('Underweight')
elseif (18.5<BMI)&&(BMI<=24.9)
disp('Normal')
elseif (25<BMI)&&(BMI<=29.9)
disp('Overweight')
elseif BMI>=30
disp('Obese')
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SAMPLE RUN:

>> calculateBMI(68,110)

BMI =

16.7236

Underweight

ans =

16.7236

>> calculateBMI(74,180)

BMI =

23.1081

Normal

ans =

23.1081

>> calculateBMI(61,150)

BMI =

28.3392

Overweight

ans =

28.3392

>> calculateBMI(64,200)

BMI =

34.3262

Obese

ans =

34.3262

>>