This function computes a person's body-mass index, or BMI, given his/her current weight in pounds and height in inches. The function also plots BMI versus weight for a range of weights specified by wRange.
Note that although the inputs are in U.S. conventional units of measure (so that it is convenient for use in the United States), the resulting BMI value is measured, by definition, in SI units.
To modify the code to use SI units for the input arguments, simply replace the line
useSIunits = false;
with the line
useSIunits = true;
and save the code. Then, when calling the function from the MATLAB, use kilograms for weight and meters for height, and the result should be correct. Note that the function will automatically change the units of measure in the title and the labels for each axis.
The author makes no claim as to the validity or usefulness of BMI as a measure of overall health or wellness. There are many resources available on the web and in the literature that describe BMI, what it means, and how to interpret the results.
Syntax:
b = bmi(height,weight);
b = bmi(height,weight,wRange);
Example:
height = 68; % inches
weight = 174; % pounds
b = bmi(height,weight,[ 150 210 ]); |