# Solutions to Selected Exercises

## Chapter 1

1.1

a = 3; b = 5; sum = a + b; difference = a - b; product = a * b; quotient = a / b;

## Chapter 2

2.1

(a) Comma should be replaced by decimal point

(e) Asterisk should be omitted

(f) Exponent must be integer

(h) Comma should be replaced by decimal point

2.2

(b) Decimal point not allowed

(c) First character must be letter

(d) Quotes not allowed

(h) Blanks not allowed

(i) Allowed but not recommended

(k) Asterisk not allowed

(l) Allowed but not recommended

2.3

(a) p + w/u

(b) p + w/(u + v)

(c) (p + w/(u+v))/(p + w/(u-v))

(d) sqrt(x)

(e) y^(y+z)

(f) x^(y^z)

(g) (x^y)^z

(h) x - x^3/(3*2) + x^5/(5*4*3*2)

2.4

(a) i = i + 1

(b) i = î3 + j

(c)

if e > f g = e else ...

Get *Essential MATLAB for Engineers and Scientists, 6th Edition* now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.