0% found this document useful (0 votes)
372 views

MATLAB For Engineering Applications 4th Ed 2019 Ebook Chap 1 Sol

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
372 views

MATLAB For Engineering Applications 4th Ed 2019 Ebook Chap 1 Sol

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Solutions Manual©

to accompany

MATLAB for Engineering Applications, Fourth Edition

By

William J. Palm III

University of Rhode Island

Solutions to Problems in Chapter One

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
Test Your Understanding Problems

T1.1-1 Depending on what toolboxes you have installed, you should see something like

MATLAB Version 9.2 (R2017a Release)


Simulink Version 8.9 (R2017a Release)
Control System Toolbox Version 10.2 (R2017a Release)
Symbolic Math Toolbox Version 7.2 (R2017a Release)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.1-2 a) 6*10/13 + 18/(5*7) + 5*9^2. Answer is 410.1297.

b) 6*35^(1/4) + 14^0.35. Answer is 17.1123.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.1-3 Type the expressions given in the problem to obtain a) 0.04 b) 0.02 c) 0.2 d) 32.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.1-4

x = -5 + 9i; y = 6 - 2i;
S = x + y
P = x*y
R = x/y

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.3-1 The session is:

>>x = cos(0):0.02:log10(100);
>>length(x)
ans =
51
>>x(25)
ans =
1.4800

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.3-2 The session is:

>>roots([1, 6, -11, 290]


ans =
-10.000
2.0000 + 5.0000i
2.0000 - 5.0000i

The roots are −10 and 2 ± 5i.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.3-3 The script is:

x = 0:0.01:10;
y = 3*x.^2 + 2;
plot(x,y), xlabel('x'),ylabel('y')

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.3-4 The session is:

>>t = 0:0.01:5;
>>s = 2*sin(3*t+2) + sqrt(5*t+1);
>>plot(t,s),xlabel(‘Time (sec)’),ylabel(‘Speed (ft/sec)’)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.3-4 The session is:

>>x = 0:0.01:1.5;
>>y = 4*sqrt(6*x+1);
>>z = 5*exp(0.3*x)-2*x;
>>plot(x,y,x,z,’—‘0),xlabel(‘Distance (m)’),ylabel(‘Force (N)’)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.3-5 The session is:

>>x = 0:0.01:1.5;
>>y = 4*sqrt(6*x+1);
>>z = 5*exp(0.3*x)-2*x;
>>plot(x,y,x,z,’- -‘),xlabel(‘Distance (m)’),ylabel(‘Force (N)’)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.4-1 The script is:

r = input(‘Enter the sphere radius:’);


A = 4*pi*r^2;
disp(‘The surface area is:’)
disp(A)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.4-2 The script is:

a = input('Enter a: ')
b = input('Enter b: ')
c = sqrt(a^2+b^2)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.5-1 Typing help nthroot returns:

“nthroot(X, N) returns the real Nth root of the elements of X.”

“Both X and N must be real, and if X is negative, N must be an odd integer.”

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.5-2 Typing lookfor hyperbolic returns 12 functions.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
T1.5-3 Typing “help why” returns:

“ why Provides succinct answers to almost any question.”

“ why, by itself, provides a random answer.”

“why(N) provides the N-th answer.”

“ Please embellish or modify this function to suit your own tastes.”

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
End-of-Chapter Problems

1.1. The session is:

>>x = 10; y = 3;
>>u = x + y
u =
13
>>v = x*y
v =
30
>>w = x/y
w =
3.3333
>>z = sin(x)
z =
-0.5440
>>r = 8*sin(y)
r =
1.1290
>>s = 5*sin(2*y)
s =
-1.3971

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.2. The session is:

>>y*x^3/(x-y)
ans =
-13.3333
>>3*x/(2*y)
ans =
0.6000
>>3*x*y/2
ans =
15
>>x^5/(x^5-1)
ans =
1.0323

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.3. The session is:

>>x = 3; y = 4;
>>1/(1-1/x^5)
ans =
1.0041
>>3*pi*x^2
ans =
84.8230
>>3*y/(4*x-8)
ans =
3
>>4*(y-5)/(3*x-6)
ans =
-1.3333

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.4. a) x = 3;y = 6*x^3 + 4/x. The answer is y = 163.3333.

b) x = 7;y = (x/4)*3. The answer is y = 5.2500.

c) x = 9;y = (4*x)^2/25. The answer is y = 51.8400.

d) x = 4;y = 2*sin(x)/5. The answer is y = −0.3027.

e) x = 30;y = 7*x^(1/3) + 4*x^0.58. The answer is y = 50.5107.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.5. The session is:

>>a = 1.12; b = 2.34; c = 0.72;d = 0.81;f = 19.83;


>>x = 1 + a/b + c/f^2
x =
1.4805
>>s = (b-a)/(d-c)
s =
13.5556
>>r = 1/(1/a + 1/b + 1/c + 1/d)
r =
0.2536
>>y = a*b/c*f^2/2
y =
715.6766

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.6. The session is:

>>a = (3/4)*6*7^2+4^5/(7^3-145);
>>b = (48.2*55-9^3)/(53+14^2);
>>c = 27^2/4+319^(4/5)/5+60*14^-3;

The answers are: a = 225.6717, b = 7.7189, and c = 202.4120.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.7. a) 1/16, 16^-1, and 16^(-1) all give the correct answer: 0.0625.

b) 16^ (-1/2) gives the correct answer: 0.25. 16^-1/2 is incorrect.

c) 16^(-1/2) gives the correct answer: 0.25.

d) 64^(3/2) gives the correct answer: 512. 64^3/2 is incorrect.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.8. a) 0.01 b) 0.005 c) 0.1 d) 500,000

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
151
1.9. a) c=8, overflow b) f = 0, underflow, c) i) x = 8 ii) y = 25, x =7.5 x 10

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.10. The session is:

>>r = 6; h = 10
>>V = pi*r^2*h;
>>V = 1.3*V;
>>r = (V/(pi*h))^(1/2)
r = 6.8411

The required radius is 6.8411.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.11. The session is:

>>r = 4;
>>V = 4*pi*r^3/4;
>>V = 1.4*V;
>>r = ((3*V)/(4*pi))^(1/3)
r =
4.0656

The required radius is 4.958.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.12. The session is

>>x = -7-5i;y = 4+3i;


>>x+y
ans =
-3.0000 - 2.0000i
>>x*y
ans =
-13.0000 -41.0000i
>>x/y
ans =
-1.7200 + 0.0400i

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.13. The session is:

>>(3+6i)*(-7-9i)
ans =
33.0000 -69.0000i
>>(5+4i)/(5-4i)
ans =
0.2195 + 0.9756i
>>3i/2
ans =
0 + 1.5000i
>>3/2i
ans =
0 - 1.5000i

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.14. The session is:

>>x = 5+8i;y = -6+7i;


>>u = x + y;v = x*y;
>>w = x/y;z = exp(x)
>>r = sqrt(y);s = x*y^2;

The answers are u = −1+15i, v = −86−13i, w = 0.3059−0.9765i, z = −21.594+146.83i,


r = 1.2688 + 2.7586i, and s = 607 − 524i.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.15. The session is:

>>n = 1;R = 0.08206;T = 273.2;V=22.41;


>>a = 6.49;b = 0.0562;
>>Pideal = n*R*T/V
Pideal =
1.0004
>>P1 = n*R*T/(V - nb)
P1 =
1.0029
>>P2 = (a*n^2)/V^2
P2 =
0.0129
>>Pwaals = P1 + P2
Pwaals =
1.0158

The ideal gas law predicts a pressure of 1.0004 atmospheres, while the van der Waals model
predicts 1.0158 atmospheres. Most of the difference is due to the P2 term, which models
the molecular attractions.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.16. The ideal gas law gives
T P
= = constant
V nR

Thus T1 / V1 = T2 / V2 or V2 = V1T2 / T1 . The session is:

>>V1 = 28500;T1 = 273.2 - 15;T2 = 273.2 + 31;


>>V2 = V1*T2/T1
V2 = 3.3577e+4

The volume is 33,577 cubic feet.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.17. a) exp(2) gives 7.3891.

b) log10(2) gives 0.3010.

c) log(2) gives 0.6931. ln(2) gives "Undefined function or variable 'ln'."

d) 600^(1/4) gives the correct answer: 4.9492. 600^1/4 gives 150, which is incorrect.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.18. a) cos(pi/2) gives 6.1232e-17.

b) cosd(80) gives 0.1736.

c) acos(0.7) gives 0.7954.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.19. a) atan(2) gives 1.1071.

b) atand(100) gives 89.4271.

c) atan2d(3,2) gives 56.3099 degrees.

d) atan2d(3,-2) gives 123.6901 degrees.

e) atan2d(-3,2) gives $-$56.3099 degrees.

d) acosd(0.6) gives 53.1301.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.20. The session is:

>>x=1:0.2:5;
>>y = 7*sin(4*x);
>>length(y)
ans =
21
>>y(3)
ans =
-4.4189

There are 21 elements. The third element is −4.4189.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.21. The session is:

>>x = sin(-pi/2):0.05:cos(0);
>>length(x)
ans =
41
>>x(10)
ans =
-0.5500

There are 41 elements. The tenth element is 0.55.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.22. The session is:

>>a = exp(-2.1^3)+3.47*log10(14)+(287)^(1/4);
>>b = 3.4^7*log10(14)+(287)^(1/4);
>>c = (cos(4.12*pi/6))^2;
>>d = cos((4.12*pi/6)^2);

The answers are a = 8.0931, b = 6.0240 × 103, c = 0.3062, and d = −0.0587.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.23. The session is:

>>a = 6*pi*atan(12.5)+4;
>>b = 5*tan(3*asin(13/5));
>>c = 5*log(7);
>>d = 5*log10(7);

The results are a = 32.1041, b = 0.0000 − 5.0006i, c = 9.7296, and d = 4.2255. In part (b)
note that complex results are obtained from asin(x) if |x| > 1 and from tan(x) if x is
complex.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.24. The session is:

>>ratio=10^(1.5*7.6)/10^(1.5*5.6)

The answer is ratio = 1000, or 1000 times more energy.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.25. The session is:

>>p = ([13,182,-184,2503];
>>r = roots(p)
r =
-15.6850
0.8425 + 3.4008i
0.8425 - 3.4008i

The roots are x = −15.685 and x = 0.8425 ± 3.4008i.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.26. The session is:

>>p = [70, 24, -10, 20];


>>roots(p)
ans =
-0.8771
0.2671 + 0.5044i
0.2671 - 0.5044i

The roots are −0.8771 and 0.2671 ± 0.5044i.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.27. The session is:

>>t = 1:0.005:3;
>>T = 6*log(t) - 7*exp(-0.2*t);
>>plot(t,T),title(‘Temperature Versus Time’),...
xlabel(‘Time t (min)’),ylabel(‘Temperature T ^\circ C)’)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.28. The session is:

>>x = 0:0.01:2;
>>u = 2*log10(60*x+1);
>>v = 3*cos(6*x);
>>plot(x,u,x,v,0--0),ylabel(‘Speed (mi/hr)’),xlabel(‘Distance x (mi)’)

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.29. The session is

>>x1 = [0,pi];
>>x2 = [-pi,0];
>>x = -pi:0.01:pi;
>>f1 = [1,1];
>>f2 = -[1,1];
>>series =
(4/pi)*(sin(x)+(1/3)*sin(3*x)+(1/5)*sin(5*x)+(1/7)*sin(7*x));
>>plot(x,series,x1,f1,x2,f2),xlabel(‘x’)

The plot is shown in the figure.

Figure for Problem 1.29

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.30. The session is

>>r = 10;
>>phi = 0:0.01:4*pi;
>>x = r*(phi-sin(phi));
>>y = r*(1-cos(phi));
>>plot(x,y),xlabel(‘x’),ylabel(‘y’)

The plot is shown in the figure.

Figure for Problem 1.30

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.31. The script is

v=20; % speed(km/hr)
T=3; % total time (hr)
phi = atan(11/15); % course angle (rad)
t = 0:0.005:T; % time variable
x = -10 + (v*cos(phi))*t; % x variable
y = (11/15)*x + 43/3; % y variable
theta = atan2d(y,x); % bearing angle
plot(t,theta), xlabel('t (hr)'),ylabel('theta (deg)')

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.32. The answer depends on the user's computer system.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.33. Note that
W 2 = D2 + D2 = 2 D2

Thus D = W / 2. The area is given by


D2 W2
A = WL + = WL +
2 4

which can be solved for L:


W2
A-
L= 4
W
The perimeter is given by
W
P = 2L + W + 2
2
The script file is:

W = 6; A = 80;
L = (A - W^2/4)/W
P = 2*L + W + 2*W/sqrt(2)

The answers are L = 11.8333 meters and the total length is the perimeter P = 38.1519
meters.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.34. Applying the law of cosines to the two triangles gives

a2 = b12 + c12 - 2b1c1 cos A1

a2 = b22 + c22 - 2b2c2 cos A2

With the given values we can solve the first equation for a1, then solve the second equation
for c2. The second equation is a quadratic in c2, and can be written as

c22 -(2b2 cos A2 ) c2 + b22 - a2 = 0

The script file is:

b1 = 180;b2 = 165;c1 = 115;


A1 = 120*pi/180;A2 = 100*pi/180;
a = sqrt(b1^2 + c1^2 - 2*b1*c1*cos(A1));
roots([1,-2*b2*cos(A2),b2^2-a^2])

The two roots are c2 = −228 and c2 = 171. Taking the positive root gives c2 = 171 meters.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.35. The script is

disp('To compute the roots of x^3+ax^2+bx+c=0, enter a, b, and c.')


a = input('Enter a: ');
b = input('Enter b: ');
c = input('Enter c: ');
roots([1,a,b,c])

For example, if a= 23, b = 4, and c = 5, the roots are

-22.8344 + 0.0000i

-0.0828 + 0.4606i

-0.0828 - 0.4606i

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.36. Typing “help plot” gives the required information. Typing “help label” obtains the
response “label not found”. In this case we need to be more specific, such as by typing
“help xlabel”, because label is not a command or function, or we can type “lookfor label”.

Similarly, typing “help cos” gives the required information, but typing “help cosine” obtains
the response “cosine not found”. Typing “lookfor cosine” directs you to the cos command.
Typing “help :” and “help *” gives the required information.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.37. Typing “help sqrt” produces the response “sqrt(X) is the square root of the elements of X. Complex
results are produced if X is not positive.”

It is suggested to investigate realsqrt(X), which gives the square root of the elements of X. An error is
produced if X is negative.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.38. Typing “help exp” gives the response “exp(X) is the exponential of the elements of X, e to the X. For
complex Z=X+i*Y, exp(Z) = exp(X)*(COS(Y)+i*SIN(Y))”.
z x
From Euler’s identity, if z = x + iy, e = e (cos y + i sin y).

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.39. (a) If we neglect drag, then conservation of mechanical energy states that the kinetic
energy at the time the ball is thrown must equal the potential energy when the ball reaches
the maximum height. Thus
1 2
mv = mgh
2
where v is the initial speed and h is the maximum height. We can solve this for v:
v = 2 gh
Note that the mass m cancels, so the result is independent of m.

For h = 20 feet, we get


v = 2(32.2)(20) = 35.9 ft /sec

Because speed measured in miles per hour is more familiar to most of us, we can convert the answer to
miles per hour as a “reality check” on the answer. The result is v = 35.9(3600)/5280 = 24.5 miles per hour,
which seems reasonable.

(b) The issues here are the manner in which the rod is thrown and the effect of drag on
the rod. If the drag is negligible and if we give the mass center a speed of 35.9 feet/second,
then the mass center of the rod will reach a height of 20 feet. However, if we give the rod
the same kinetic energy, but throw it upward by grasping one end of the rod, then it will
spin and not reach 20 feet. The kinetic energy of the rod is given by

1 2 1
KE = mvmc + I w2
2 2
where vmc is the speed of the rod’s mass center. For the same rotational speed and kinetic
energy, a rod with a larger inertia I will reach a smaller height, because a larger fraction
of its energy is contained in the spinning motion. The inertia I increases with the length
and radius of the rod. In addition, a longer rod will have increased drag, and will thus reach
a height smaller than that predicted using conservation of mechanical energy.

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.
1.40. (a) When A = 0, d = L1 + L2. When A = 180, d = L1 − L2. The stroke is the
difference between these two values. Thus the stroke is L1 + L2 − (L1 − L2) = 2L2 and
depends only on L2.

b) The MATLAB session looks like the one shown in the text, except that L1 = 0.6 is
used for the first plot and L1 = 1.4 for the second plot . The plots are shown in the following two
figures. Their general shape is similar, but they are translated vertically relative to one
another.

Figure for Problem 1.40

Figure for Problem 1.40

Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the
prior written consent of McGraw-Hill Education.

You might also like