Please script the problems using MATLAB (1). A biomedical experiment is being co
ID: 669181 • Letter: P
Question
Please script the problems using MATLAB
(1). A biomedical experiment is being conducted only on subjects whose blood pressure is optimal. This is defined as a systolic blood pressure less than 120 and a diastolic blood pressure less than 80. Write a script that will prompt for the systolic and diastolic blood pressure of the user, and will print whether or not the user is a candidate for this experiment.
(2). Write a program that will prompts the user for the (x,y) coordinates and then determine in which quadrant if falls in. Your program should also be able to tell if it is on one of the axis or if it is right on top of the origin. In other words, there are seven possible locations: quadrant 1, quadrant 2, quadrant 3, quadrant 4, on the X-axix, on the y-axis and on the origin. Display proper feedback to the screen, You have the choice to use or not to use a nested if statement.
Explanation / Answer
(2)
x=4;y=0; %test value
switch true
case x >=0 && y>0
disp('Quadrant I')
case x <=0 && y>0
disp('Quadrant II')
case x <=0 && y<0
disp('Quadrant III')
case x >=0 && y<0
disp('Quadrant IV')
case x >0 && y==0 || x<0
disp('X - Axis')
case y>0 && x==0 || y<0
disp('Y - Axis')
otherwise
disp('Origin')
end
(1)
s = input('Enter Systolic Blood Pressure : ')
d = input('Enter diastolic Blood Pressure : ')
switch true
case s<120 && d<80
disp('User is fit for Experiment')
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.