4.8 Exercises 4. Evaluate the following MATLAB expressions (a) 55.5 b)2020 xor 1
ID: 675369 • Letter: 4
Question
4.8 Exercises 4. Evaluate the following MATLAB expressions (a) 55.5 b)2020 xor 17 pi 15, pi false (e)-(35 / 17) == (35 / 17) (3) 17.5&(3.3 2.) 4.2 sin /cos . This expression The tangent function is defined as tan can be evaluated to solve for the tangent as long as the magnitude ofeo is not too near to O. (If cos is 0, evaluating the equation for tan wa produce the nonnumerical value Inf.) Assume that is given in degrees, and write the MATLAB statements to evaluate tan as long as the magna tude ofcos is greater than or equal to 10-2 . If the magnitude of cos Oi, less than 10 write out an error message insteadExplanation / Answer
4.1
matlab code with the corresponding variable for each expression:
a=5>5.5
b=20>20
c=xor(17-pi<15,pi<3)
d=true>false
e=~~(35/17)==(35/17)
f=(7<=8)==(3/2==1)
g=17.5 && (3.3>2)
Output:
4.3)
The statements are incorrect because, every time the user enters temperature more than 97.5 it wiil diplay an alert as Tempearature below normal, even though the user input temperature is 98 or more than the other alternatives because of conditonal statement if temp>97.5.
code with necessary corrections:
prompt='temperature of the user:';
temp = input(prompt)
if temp<=97.5
disp('Tempearature below normal');
elseif temp>97.5 && temp<=99.5
disp('Tempearature normal');
elseif temp>99.5 && temp<=103
disp('Tempearature slightly high');
elseif temp>103
disp('Tempearature dangerously high');
end
output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.