Problem 44945. Calculate BMI
Given a matrix hw (height and weight) with two columns, calculate BMI using these formulas:
- 1 kilogram = 2.2 pounds
- 1 inch = 2.54 centimeters
- BMI = weight(kg) / [height(m)]^2
The first column is the height in inches. The second column is the weight in pounds.
Solution Stats
Problem Comments
-
19 Comments
Show
16 older comments
Christian Schröder
on 9 Aug 2024
@Prathamesh Using your code, bmi is returned as a row vector, but the test suite expects a column vector.
Juan
on 16 Nov 2024
In this excercise the big deal is to recognice that the solution must be in the same format as the entry data. That in this case is a Column Vector.
Robert
on 29 May 2025 at 16:16
The conversions are confusing. The formula requires kilograms and meters. To calculate, the conversion matrix used for the dot product must be:
[.0254 1/2.2]
Solution Comments
Show commentsProblem Recent Solvers9863
Suggested Problems
-
1424 Solvers
-
Determine Whether an array is empty
790 Solvers
-
745 Solvers
-
1587 Solvers
-
Converts numbers into characters
1570 Solvers
More from this Author13
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!