Exercises
Please complete each exercise or answer the question on paper or in Matlab before reviewing the posted solution comments.
-
What is the result of following boolean expression for each pair of values of
temp1
andtemp2
?(temp1 > 212 | temp1 < 32) & (temp2 > 212 | temp2 < 32)
temp1
temp2
Result 70 70 ________ 220 70 ________ 30 70 ________ 70 220 ________ 70 30 ________ 30 30 ________ 220 30 ________ 30 220 ________ Here is the completed table.
temp1
temp2
Result 70 70 false 220 70 false 30 70 false 70 220 false 70 30 false 30 30 true 220 30 true 30 220 true -
What question does the above boolean expression answer?
It returns true if H2O is steam or ice at both
temp1
andtemp2
. Another way to phrase this result is: "If it returns false, then H20 is water at eithertemp1
ortemp2
. -
Write a boolean expression that returns true if H2O would be water at
temp1
andtemp2
?temp1 <= 212 & temp1 >= 32 & temp2 <= 212 & temp2 >= 32