MATLAB: A Practical Introduction to Programming and Problem Solving
MATLAB: A Practical Introduction to Programming and Problem Solving
5th Edition
ISBN: 9780128163450
Author: ATTAWAY
Publisher: ELSEVIER
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 1, Problem 1.3P
To determine

To find:

The result produced from the given expressions and verify them using MATLAB.

Expert Solution & Answer
Check Mark

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 1. If the expression is false, then it will have the logical value 0. The given expression “3==5+2” is false. Hence, the output will be 0.

Consider the value of a is 0 and the value of b is 1. The output will be,

b<a+11<0+1

The obtained output is false. Hence, it will have the logical value 0.

The given expression “10>5+2” is false. Hence, the output will be 1.

In the expression “(10>5)+2”, first “(10>5)” will be evaluated. This expression is true. Hence, it will have the logical value 1. Add “2” to this logical value. The final output is 3.

Consider the value of c is 0 and the value of d is 1 in the expression “'c'=='d'-1&&2<4”. The expression becomes,

c==d1&&2<40==11&&2<4

In this expression, the order of preference is “,<,==,&&”. Hence,

0==(11)&&2<40==0&&(2<4)     (0==0)&&1     1&&1     1

Consider the value of c is 0 and the value of d is 1 in the expression “'c'=='d'-1||2>4”. The expression becomes,

c==d1||2>40==11||2>4

In this expression, the order of preference is “,<,==,||”. Hence,

                  0==(11)||2>4                  0==0||(2>4)(0==0)||0                     1||0                        1

Consider the value of c is 0 and the value of d is 1 in the expression “xor('c'=='d'-1, 2>4)”. The expression becomes,

xor(c==d1,2>4)xor(0==11,2>4)

In this expression, the order of preference is “,<,==,xor”. Hence,

xor(0==(11),2>4)xor(0==0,(2>4))xor((0==0),0)xor(1,0)1

Consider the value of c is 0 and the value of d is 1 in the expression “xor('c'=='d'-1&&2<4)”. The expression becomes,

xor(c==d1,2<4)xor(0==11,2<4)

In this expression, the order of preference is “,<,==,xor”. Hence,

xor(0==(11),2<4)xor(0==0,(2<4))xor((0==0),1)xor(1,1)0

In the expression “10>5>2”, first “(10>5)” will be evaluated. This expression is true. Hence, it will have the logical value 1. Now “(1>2)” is false. Hence, it will have the logical value 0.

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:

MATLAB: A Practical Introduction to Programming and Problem Solving, Chapter 1, Problem 1.3P , additional homework tip  1

MATLAB: A Practical Introduction to Programming and Problem Solving, Chapter 1, Problem 1.3P , additional homework tip  2

Therefore, the required variable is created.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
If a uniform distribution is defined over the interval from 6 to 10, then answer the followings: What is the mean of this uniform distribution? Show that the probability of any value between 6 and 10 is equal to 1.0 Find the probability of a value more than 7. Find the probability of a value between 7 and 9.   The closing price of Schnur Sporting Goods Inc. common stock is uniformly distributed between $20 and $30 per share. What is the probability that the stock price will be: More than $27? Less than or equal to $24?   The April rainfall in Flagstaff, Arizona, follows a uniform distribution between 0.5 and 3.00 inches. What is the mean amount of rainfall for the month? What is the probability of less than an inch of rain for the month? What is the probability of exactly 1.00 inch of rain? What is the probability of more than 1.50 inches of rain for the month? The best way to solve this problem is begin by creating a chart. Clearly mark the range, identifying the lower and upper…
Problem 1: The mean hourly pay of an American Airlines flight attendant is normally distributed with a mean of 40 per hour and a standard deviation of 3.00 per hour. What is the probability that the hourly pay of a randomly selected flight attendant is: Between the mean and $45 per hour? More than $45 per hour? Less than $32 per hour?   Problem 2: The mean of a normal probability distribution is 400 pounds. The standard deviation is 10 pounds. What is the area between 415 pounds and the mean of 400 pounds? What is the area between the mean and 395 pounds? What is the probability of randomly selecting a value less than 395 pounds?   Problem 3: In New York State, the mean salary for high school teachers in 2022 was 81,410 with a standard deviation of 9,500. Only Alaska’s mean salary was higher. Assume New York’s state salaries follow a normal distribution. What percent of New York State high school teachers earn between 70,000 and 75,000? What percent of New York State high school…
Pls help asap
Knowledge Booster
Background pattern image
Statistics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, statistics and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Intermediate Algebra
Algebra
ISBN:9780998625720
Author:Lynn Marecek
Publisher:OpenStax College
Text book image
Glencoe Algebra 1, Student Edition, 9780079039897...
Algebra
ISBN:9780079039897
Author:Carter
Publisher:McGraw Hill
Text book image
College Algebra (MindTap Course List)
Algebra
ISBN:9781305652231
Author:R. David Gustafson, Jeff Hughes
Publisher:Cengage Learning
Text book image
Algebra: Structure And Method, Book 1
Algebra
ISBN:9780395977224
Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. Cole
Publisher:McDougal Littell
Text book image
Holt Mcdougal Larson Pre-algebra: Student Edition...
Algebra
ISBN:9780547587776
Author:HOLT MCDOUGAL
Publisher:HOLT MCDOUGAL
Text book image
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:9781133382119
Author:Swokowski
Publisher:Cengage
What is a Linear Equation in One Variable?; Author: Don't Memorise;https://www.youtube.com/watch?v=lDOYdBgtnjY;License: Standard YouTube License, CC-BY
Linear Equation | Solving Linear Equations | What is Linear Equation in one variable ?; Author: Najam Academy;https://www.youtube.com/watch?v=tHm3X_Ta_iE;License: Standard YouTube License, CC-BY