0% found this document useful (0 votes)
130 views3 pages

Calculating BMI by Using MATLAB: A Solution To Assignment 1

The document outlines a grading rubric for a MATLAB assignment to calculate BMI. It includes exemplary, proficient, developing, beginning, and novice scoring levels for output/results, coding performance, coding style/formatting, and presentation. It also includes the MATLAB code to calculate BMI based on weight and height input in either pounds/feet or kilograms/meters. The code outputs the BMI category based on predefined ranges. Sample output is provided showing a "normal" BMI result.

Uploaded by

tooba Ishfaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views3 pages

Calculating BMI by Using MATLAB: A Solution To Assignment 1

The document outlines a grading rubric for a MATLAB assignment to calculate BMI. It includes exemplary, proficient, developing, beginning, and novice scoring levels for output/results, coding performance, coding style/formatting, and presentation. It also includes the MATLAB code to calculate BMI based on weight and height input in either pounds/feet or kilograms/meters. The code outputs the BMI category based on predefined ranges. Sample output is provided showing a "normal" BMI result.

Uploaded by

tooba Ishfaq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

A Solution to Assignment 1

Calculating BMI by using MATLAB

CL206: Introduction to Programming in MATLAB

Grading Rubrics
Statement Exemplary (5) Proficient (4) Developing (3) Beginning (2) Novice (1) Score

Output/ Results (60) Able to get Able to get Able to get Able to get some Not able to
accurate and accurate results results from the of the results get any
self-explanatory from the program with from the program results from
1 results from the program with major the program
program. minor mistakes(s).
mistake(s)
Coding Performance Able to write Able to write Able to write Struggling to The student
(20): efficient code fairly good code code in write the code. is not able to
with appropriate with some hardcoding write the
3 Ability to write appropriate error handlers. logical errors or without any error code.
error handlers and efficient missing error handler.
code without hardcoding handlers.
and errors.
Coding Style/ formatting Able to write Able to write Used some of Used marginal None of the
(15): program in program in the mentioned formatting formatting
excellent coding good coding formatting techniques in the techniques
Ability to use necessary style fulfilling all style missing 1- techniques in the program. were used in
2 commands at the start of the mentioned 2 mentioned program. the program.
the program, provide criterion. criterion.
appropriate description of
function, write comments
and use proper indentation.
Presentation (5%): Able to present Able to present Able to present Hardly able to Unable to
Content, Organization and the written report the written the written report present the present the
formatting of written report in an appropriate report in an in an appropriate written report in written report
5 formatting. appropriate formatting with appropriate in
formatting with major formatting. appropriate
minor mistakes(s). format.
mistake(s)

Attained Score

Submitted By:
Submitted To:

Intro. to Programming in MATLAB


Assignment 1
……………………….Start of MATLAB Code………………………...

function [] = A1_18L0702()
clc
clear
%BMI = mass / height^2 = (kg/m^2) in SI units
disp('Hi, this is the BMI calculator.')
disp(' ')
Weight = input('Enter your weight (lbs), or type 0 for SI units: ');
if Weight == 0
Weight = input('Enter your mass (kg): ');
Height = input('Enter your height (m): ');
BMI = (Weight / (Height^2)); %kg/m^2
else
Height = input('Enter your height (ft): ');
%Conversion to SI units
BMI = (Weight / (Height^2)) * 4.882427111; %kg/m^2
end
if (BMI < 16.5)
disp('You are well below underweight')
else if ((BMI > 16.5) && (BMI <= 18.5))
disp('You are underweight')
else if ((BMI > 18.5) && (BMI <= 25))
disp('You are normal')
else if ((BMI > 25) && (BMI <= 30))
disp('You are overweight')
else if ((BMI > 30) && (BMI <= 35))
disp('You are grouped as obese Class I')
else if ((BMI > 35) && (BMI <= 40))
disp('You are grouped as obese Class II')
else if (BMI > 40)
disp('You are grouped as obese Class III')
end
end
end
end
end
end
end
disp(' ')
disp('Posssible BMI ranges: < 16.5 well below underweight, 16.5-18.5
underweight, 18.5-25 normal, 25-30 overweight, > 30 obese')
% The possible BMI categories are as follows: a BMI of less than 16.5
% indicates severe underweight, 16.5 to 18.5 is underweight, 18.5 to 25
% is normal, 25 to 30 is overweight. The Obese category range from 30-35
% (class I), 35-40 (class II), and over 40 is class III.
end

……………………….End of MATLAB Code………………………...

Intro. to Programming in MATLAB


Assignment 1
……………………….Start of Results………………………...

Hi, this is the BMI calculator.

Enter your weight (lbs), or type 0 for SI units:


140
Enter your height (ft):
6
You are normal

Posssible BMI ranges: < 16.5 well below underweight, 16.5-18.5


underweight, 18.5-25 normal, 25-30 overweight, > 30 obese
 

……………………….End of Results………………………...

Intro. to Programming in MATLAB


Assignment 1

You might also like