You are on page 1of 4

CL2014 MATLAB Programming

Lab work # 5

Title: Plotting a graph of BMI in MATLAB


Student Name: ALISHA ASHRAF
Student ID: 22L-7182
Date of Submission: 26/10/2023

Grading Rubrics
Exemplary Proficient Developing Beginning
Statement Novice (1) Score
(5) (4) (3) (2)
1 Output/ Results Able to produce Able to Able to get Hardly able to Not able to

(40%) a high quality produce a some results produce the get any
code with code with from the code without results from
desired output desired output program with instructor’s the program
results. having minor major help without
mistake(s) mistakes(s). instructors
help in
every step

2 Coding Style/ Able to write Able to write Used some of Used marginal None of the

formatting program in program in the mentioned formatting formatting


excellent coding good coding formatting techniques in techniques
(20%):
style fulfilling style missing techniques in the program. were used in
Ability to use
all the 1-2 mentioned the program. the program.
necessary
mentioned criterion.
commands at the criterion.
start of the
program, provide
appropriate
description of
function, write
comments and use
proper indentation.
3 Coding Able to write Able to write Able to write Struggling to The student

Performance efficient code fairly good correct code in identify and is not able to
with appropriate code with hardcoding correct the identify and
(20%):
error handlers. some logical without any errors in the correct the
Ability to write
errors or error handler. codes without errors in his
appropriate error
missing error help. code.
handlers and handlers.
efficient code

Page 1 of 4
without
hardcoding and
errors.
4 Lab Able to finish Able to finish Able to finish Struggling to Unable to

Management coding most of the most of the finish the code finish the
complete in all coding within coding within without code without
(20%):
aspects within given time given time instructors instructors
Time management
given time missing 1-2 missing 3-4 help help in
content
criteria criteria every step
organization

Attained Score

…………………….Start of MATLAB Code……………………….


% THIS IS MY 5TH TUTORIAL
% ALISHA ASHRAF
% 22L-7182
% SECTION C

clc
clear
z = input ('Enter weight kilograms =');
h = input ('Enter height in meters =');
d = h/100;
e = d^2;
BMI = z/e;
disp (['the BMI is = :' num2str(BMI)])
if BMI>=0 && BMI<=18.5
disp ('underweight')
elseif BMI>=18.5 && BMI<=25.0
disp ('Normalweight')
elseif BMI>=25 && BMI<=30
disp ('Overweight')
elseif BMI>30
disp ('Obese')

Page 2 of 4
end
plot ([z,z] ,[0,h], 'r')
text (z,h, ['+Your BMI IS:',num2str(BMI)])
hold on
BMI1 = 18.9;
BMI2 = 24.9;
BMI3 = 29.9;
B1=linspace(150,200);
w1 = ((BMI1.*(B1.^2)))/10000;
plot(w1,B1)
hold on
xlim([30,150])
w2 = ((BMI2.*(B1.^2)))/10000;
plot(w2,B1)
hold on
xlim([30,150])
w3 = ((BMI3.*(B1.^2)))/10000;
plot(w3,B1)
hold on
xlim([30,150])
xlabel('Weight (kg)');
ylabel('Height (cm)');
title('BMI Chart');
text(50, 185, 'Underweight','rotation', 75 ,'FontSize', 12);
text(70, 175, 'Normal weight','rotation', 75 , 'FontSize', 12);
text(100, 180, 'Overweight','rotation', 75 , 'FontSize', 12);
text(120, 165, 'Obese','rotation', 75 , 'FontSize', 12);
grid on

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

Page 3 of 4
…………………….Start of Results……………………….

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

Page 4 of 4

You might also like