O'Reilly logo

Essential MATLAB for Engineers and Scientists, 6th Edition by Daniel T. Valentine, Brian Hahn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix D

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required