High Greater than 239 Greater than 159 Less than 40 Matlab Q ollowing paragraph
ID: 3904446 • Letter: H
Question
High
Greater than 239
Greater than 159
Less than 40
Matlab Q
ollowing paragraph that explains ee main values Total cholesterol, LDL cholesterol, and HDL cholesterol High h high risk of cardiovascular disease olesterol levels are checked by a simple blood test and can be measured in ma/dl units the context of the script hat vou need 2 cholesterol levels are associat Table 1. Healthy Cholesterol Range Optimal Less than 200 Less than 130 Intermediate al Cholesterol 200-23 Cholesterol Cholesterol e 1 describes the range of values in which cholesterol is interpreted as optimal, intermediate, and hig 130-159 40-60 2. Wri ite a script that asks the user for their levels of Total cholesterol, LDL cholesterol.and ased on these three levels, the script should output a message indicating the You can use if blocks for this question, interpretation of each level. You can use if-blocks f ample, if the user input Total cholesterol 250, LDl cholesterol- 150, and HDL cholesterol: 100, t should be: h total cholesterol ermediate LDL cholesterol imal HDL cholesterol Tests your program with the following numbers and copy the output to your podf,e output is wrong or shows an error ot forget to add comments explaining your code for full grade lesterol 30 esterol 30 esterol 30 esterol = 200Explanation / Answer
MATLAB CODE FOR CREATE FUNCTION
function chol=cholesterol(tot,ldl,hdl)
if(tot>239 || tot>159 || tot<40)
disp('High Total Cholestral');
else
disp("Error");
end
if(ldl>200 && ldl<239 || ldl>130 && ldl<159 || ldl>40 && ldl<60)
disp('Intermediate LDL cholesterol');
else
disp("Error");
end
if(hdl<200 || hdl<130 || hdl>60)
disp('Optimal HDL cholesterol');
else
disp("Error");
end
end
OUTPUT-1
OUTPUT-2
(OR)
# create function cholesterol() with 3 parameters(tot,ldl,hdl)
function chol=cholesterol(tot,ldl,hdl)
# check condition if tot>239 or tot>159 or tot<40 then display message
# else display error message
if(tot>239 || tot>159 || tot<40)
disp('High Total Cholestral');
else
disp("Error");
end
# check condition if ldl in between 200 and 239 or
# ldl in between 130 and 159 or
# ldl in between 40 and 60 then display message
# else display error message
if(ldl>200 && ldl<239 || ldl>130 && ldl<159 || ldl>40 && ldl<60)
disp('Intermediate LDL cholesterol');
else
disp("Error");
end
# check condition if hdl<200 or hdl<130 or hdl>60 then
# display message else display error message
if(hdl<200 || hdl<130 || hdl>60)
disp('Optimal HDL cholesterol');
else
disp("Error");
end
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.