O'Reilly logo

A Guide to MATLAB, Second Edition by Jonathan M. Rosenberg, Brian R. Hunt, Ronald L. Lipsman

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

Solutions to the Practice Sets

Solutions to Practice Set A: Algebra and Arithmetic

1.

(a)

1111 - 345

ans =

   766

(b)

format long; [exp(14), 382801*pi]

ans =

   1.0e+06 *

   1.20260428416478      1.20260480938683

The second number is bigger.

(c)

[2709/1024; 10583/4000; 2024/765]

ans =

   2.64550781250000

   2.64575000000000

   2.64575163398693

sqrt(7)

ans =

   2.64575131106459

The third, that is 2024/765, is the best approximation.

2.

(a)

cosh(0.1)

ans =

   1.00500416805580

(b)

log(2)

ans =

   0.69314718055995

(c)

atan(1/2)

ans =

   0.46364760900081

format short

3.

[x, y, z] = solve(‘3*x + 4*y + 5*z = 2’, ...

   ‘2*x - 3*y + 7*z = -1’, ‘x - 6*y + z = 3’, ...

   ‘x’, ‘y’, ‘z’)

x =

241/92

y =

-21/92

z =

-91/92

Now we’ll check the ...

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