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
3. Explain why the following statements are not correct. a. "With my methodological approach, I can reduce the Type I error with the given sample information without changing the Type II error." b. "I have already decided how much of the Type I error I am going to allow. A bigger sample will not change either the Type I or Type II error." C. "I can reduce the Type II error by making it difficult to reject the null hypothesis." d. "By making it easy to reject the null hypothesis, I am reducing the Type I error."
Given the following sample data values: 7, 12, 15, 9, 15, 13, 12, 10, 18,12 Find the following: a) Σ x= b) x² = c) x = n d) Median = e) Midrange x = (Enter a whole number) (Enter a whole number) (use one decimal place accuracy) (use one decimal place accuracy) (use one decimal place accuracy) f) the range= g) the variance, s² (Enter a whole number) f) Standard Deviation, s = (use one decimal place accuracy) Use the formula s² ·Σx² -(x)² n(n-1) nΣ x²-(x)² 2 Use the formula s = n(n-1) (use one decimal place accuracy)
Table of hours of television watched per week: 11 15 24 34 36 22 20 30 12 32 24 36 42 36 42 26 37 39 48 35 26 29 27 81276 40 54 47 KARKE 31 35 42 75 35 46 36 42 65 28 54 65 28 23 28 23669 34 43 35 36 16 19 19 28212 Using the data above, construct a frequency table according the following classes: Number of Hours Frequency Relative Frequency 10-19 20-29 |30-39 40-49 50-59 60-69 70-79 80-89 From the frequency table above, find a) the lower class limits b) the upper class limits c) the class width d) the class boundaries Statistics 300 Frequency Tables and Pictures of Data, page 2 Using your frequency table, construct a frequency and a relative frequency histogram labeling both axes.
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