4.0

4.0 | 1 rating Rate this file 90 downloads (last 30 days) File Size: 2.32 KB File ID: #18300

Body-Mass Index

by Rick Rosson

 

12 Jan 2008 (Updated 11 Aug 2008)

Code covered by BSD License  

Computes body-mass index and plots bmi versus weight

Download Now | Watch this File

File Information
Description

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 ]);

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
15 Jan 2008 John D'Errico

I'll admit I'm not entirely sure what purpose this serves as a Matlab utility. Since it seems to be of mainly educational value, why not add some links to more information about BMI? Perhaps these are a start:

http://www.cdc.gov/nccdphp/dnpa/bmi/

http://www.cardiometabolic-risk.org/

While I won't get into the questions of whether BMI is an accurate indicator of health, nor will I get into the issue of mono-numerosis, BMI surely is one indicator of health. So the author might have added some indication of what a reasonable BMI should be. Otherwise, its just a random number. The plot might have been done so that the line varies in color, scaled so that good BMI numbers would be green, turning to red at the high end.

The help itself for bmi.m is good. Its readable and concise, defining the inputs and outputs. I'm not terribly sure why the units on the inputs are in pounds and inches, yet the returned BMI has SI units. Tradition?

I found an H1 line, but no error checking on the arguments. OTOH, the arguments are pretty simple, so I'll excuse that lack. The code is pretty simple, so nothing to go wrong, and I did find internal comments before many lines.

Now, if I can only figure out how to be nine feet tall, I'll have a perfect BMI myself. ;-)

Please login to add a comment or rating.
Updates
15 Jan 2008

Minor improvements in the M-code. Corrected units of measure from 'cm' to 'meters'. Improved conversion factor from K = 703 to more precise K = 703.7. Updated screen shot.

15 Jan 2008

Added more information and a disclaimer to the description.

16 Jan 2008

Added instrudctions to the description for modifying the code to SI units for the input arguments

30 Jun 2008

Several enhancements, including binary flag to allow SI Units and color backgrounds (red/yellow/green) to indicate ranges of BMI values.

01 Jul 2008

Updated the description to match the recent code enhancements.

02 Jul 2008

Fixed minor type in description, and modified the example slightly.

10 Jul 2008

A few minor improvements to the code and comments.

11 Jul 2008

Category was inadvertently changed. Moved it back to "Medical".

11 Aug 2008

Minor formatting improvements to the description.

Tag Activity for this File
Tag Applied By Date/Time
medical Rick Rosson 22 Oct 2008 09:42:33
bmi Rick Rosson 22 Oct 2008 09:42:33
body mass index Rick Rosson 22 Oct 2008 09:42:33
health Rick Rosson 22 Oct 2008 09:42:33
weight Rick Rosson 22 Oct 2008 09:42:33
plot Rick Rosson 31 Oct 2008 23:42:34
plotting Rick Rosson 31 Oct 2008 23:42:35
gui Rick Rosson 31 Oct 2008 23:42:35
weight loss Rick Rosson 31 Oct 2008 23:44:22
diet Rick Rosson 31 Oct 2008 23:44:22
nutrition Rick Rosson 31 Oct 2008 23:44:22
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com