Concept explainers
To find:
The result produced from the given expressions and verify them using MATLAB.
Answer to Problem 1.3P
Solution:
The required result is verified.
Explanation of Solution
The given expressions are,
3==5+2
'b'<'a'+1
10>5+2
(10>5)+2
'c'=='d'-1&&2<4
'c'=='d'-1||2>4
xor('c'=='d'-1, 2>4)
xor('c'=='d'-1, 2<4)
10>5>2
There are only two possibilities that can be concluded from the expression. If the expression is true, then it will have the logical value
Consider the value of a is
The obtained output is false. Hence, it will have the logical value
The given expression “10>5+2” is false. Hence, the output will be
In the expression “(10>5)+2”, first “(10>5)” will be evaluated. This expression is true. Hence, it will have the logical value
Consider the value of c is
In this expression, the order of preference is “
Consider the value of c is
In this expression, the order of preference is “
Consider the value of c is
In this expression, the order of preference is “
Consider the value of c is
In this expression, the order of preference is “
In the expression “10>5>2”, first “(10>5)” will be evaluated. This expression is true. Hence, it will have the logical value
MATLAB Code:
3==5+2
'b'<'a'+1
10>5+2
(10>5)+2
'c'=='d'-1&&2<4
'c'=='d'-1||2>4
xor('c'=='d'-1, 2>4)
xor('c'=='d'-1, 2<4)
10>5>2
Save the MATLAB script with name, chapter1_54793_1_3P.m in the current folder. Execute the script by typing the script name at the command window to generate output.
Result:
Therefore, the required variable is created.
Want to see more full solutions like this?
Chapter 1 Solutions
MATLAB: A Practical Introduction to Programming and Problem Solving
- Mathematics For Machine TechnologyAdvanced MathISBN:9781337798310Author:Peterson, John.Publisher:Cengage Learning,Holt Mcdougal Larson Pre-algebra: Student Edition...AlgebraISBN:9780547587776Author:HOLT MCDOUGALPublisher:HOLT MCDOUGALCollege Algebra (MindTap Course List)AlgebraISBN:9781305652231Author:R. David Gustafson, Jeff HughesPublisher:Cengage Learning
- Glencoe Algebra 1, Student Edition, 9780079039897...AlgebraISBN:9780079039897Author:CarterPublisher:McGraw HillCollege AlgebraAlgebraISBN:9781305115545Author:James Stewart, Lothar Redlin, Saleem WatsonPublisher:Cengage Learning