In: Civil Engineering
Matlab: Write a program that receives the Total Cholesterol, LDL, HDL and Tryglycerides of a patient and then use IF and AND (&&) to determine that patient is healthy or not using the following the normal level of
Total Cholesterol : below 200 mg/dl
LDL : below 130 mg/dl
HDL : above 35 mg/dl
Tryglycerides : below 200 mg/dl
If the patient is healthy show “Good health”, if not then show “See a Doctor”.
MATLAB CODE:
function HealthTest()
%prompt and read Total Cholesterol from the user
totalChol = input('Enter value of the Total Cholesterol : ');
%prompt and read LDL from the user
LDL = input('Enter value of the LDL : ');
%prompt and read HDL from the user
HDL = input('Enter value of the HDL : ');
%prompt and read Tryglycerides from the user
Tryglycerides = input('Enter value of Tryglycerides : ');
%display message to the user
display('Test Result : ')
%check all the value are normal or not
if (totalChol < 200) && (LDL < 130) && (HDL > 35) && (Tryglycerides < 200)
%display message to the user
display('Good health')
else
%display message to the user
display('See a Doctor')
end