Answer:
MATLAB function:
function dosageAmount=CalculateDosage(userWeight)
% user weight is in kg
dosageAmount=0;
% clears the variable dosageAmount
if userWeight<50
dosageAmount=10;
elseif userWeight <= 140
dosageAmount=20;
else
dosageAmount=30;
end
end
Code: >> CalculateDosage(65)
Refer to the image for more