Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given a text file ( named HeightWeightIP.txt ) that contains the heights and weights of 5 0 people in the following format: 5

You are given a text file (named HeightWeightIP.txt) that contains the
heights and weights of 50 people in the following format:
58.2799.65
67.32158.73
69.69147.27
63.78167.33
66.54155.20
68.11149.03
:: ::
where the first number in a row is a persons height in inches and the second number is the persons weight in pounds. The file can be downloaded at the page where you downloaded this assignment file. Write a MATLAB script file (named a4q5.m) that
(1) reads the data in the HeightWeightIP.txt file
(2) computes the body mass index (BMI) of each person based on his/her height and
weight. For this step, your program should call the IPtoCK function that you wrote for the last question to convert the height in inches and weight in pounds to the corresponding centimetres and kilograms. After the conversion, your program should calculate the BMI value of the person using the following formula:
=(0.01\times )2
where kg is the persons weight in kilogram and cm is the persons height in
centimetres.
(3) determines the BMI category that each person belongs to by using the following
information:
6.
BMI category
underweight normal overweight obese
BMI range
<18.518.5<=<2525<=<30>=30
(4) outputs the following information to a text file named BMI.txt: Height(cm) Weight(kg) BMI Category
148.045.2
171.072.0
177.066.8
162.075.9
169.070.4
173.067.6
20.6 normal
24.6 normal
21.3 normal
28.9 overweight
24.6 normal
22.6 normal
:::: ::::
The output file should contain 23 rows and four columns. The first row is the heading. Each row after that describes the height (in centimetres), weight (in kilograms), the BMI value, and the BMI category of the person in the corresponding row of the input file. (Hint: you can create such a file with fprintf and a loop statement.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions