SM CH
SM CH
CHAPTER 2
2.1
A=
1 2 3
2 4 6
3 2 1
A=
1 2 3
2 4 2
3 6 1
A=
1 2
2 4
3 6
A=
1 4 2
2 5 4
3 7 6
A=
12
2.3
x=y.*(a+b*z).^1.8./(z.*(1-y))
2.4
(a)
ans =
3
4
(b)
y=
0
1.5
3
4.5
6
(c)
ans =
4
2.5
clc,clf,format compact
x=[0:1/256:2];
y=1./((x-0.3).^2+0.01)+1./((x-0.9).^2+0.04)-6;
plot(x,y)
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
2
100
80
60
40
20
-20
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
2.6 (a)
>> t = linspace(4,34,6)
t=
4 10 16 22 28 34
(b)
>> x = linspace(-4,2,7)
x=
-4 -3 -2 -1 0 1 2
2.7 (a)
>> v = -2:0.5:1.5
v=
-2.0000 -1.5000 -1.0000 -0.5000 0 0.5000 1.0000 1.5000
(b)
>> r = 8:-0.5:4.5
r=
8.0000 7.5000 7.0000 6.5000 6.0000 5.5000 5.0000 4.5000
>> a:(b-a)/(n-1):b
Test case:
>> a=-3;b=5;n=6;
>> linspace(a,b,n)
ans =
-3.0000 -1.4000 0.2000 1.8000 3.4000 5.0000
>> a:(b-a)/(n-1):b
ans =
-3.0000 -1.4000 0.2000 1.8000 3.4000 5.0000
2.9 (a)
>> A=[3 2 1;0:0.5:1;linspace(6, 8, 3)]
A=
3.0000 2.0000 1.0000
0 0.5000 1.0000
6.0000 7.0000 8.0000
(b)
>> C=A(2,:)*A(:,3)
C=
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
3
8.5
2.10
format short g
a=2;b=5;
x=0:pi/40:pi/2;
y=b*exp(-a*x).*sin(b*x).*(0.012*x.^4-0.15*x.^3+0.075*x.^2+2.5*x);
z=y.^2;
w = [x' y' z']
plot(x,y,'-.pr','LineWidth',1.5,'MarkerSize',14,...
'MarkerEdgeColor','r','MarkerFaceColor','w')
hold on
plot(x,z,'-sb','MarkerFaceColor','g')
xlabel('x'); ylabel('y, z'); legend('y','z')
hold off
Output:
w=
0 0 0
0.07854 0.32172 0.10351
0.15708 1.0174 1.0351
0.23562 1.705 2.9071
0.31416 2.1027 4.4212
0.3927 2.0735 4.2996
0.47124 1.6252 2.6411
0.54978 0.87506 0.76573
0.62832 2.7275e-16 7.4392e-32
0.70686 -0.81663 0.66689
0.7854 -1.427 2.0365
0.86394 -1.7446 3.0437
0.94248 -1.7512 3.0667
1.021 -1.4891 2.2173
1.0996 -1.0421 1.0859
1.1781 -0.51272 0.26288
1.2566 -2.9683e-16 8.811e-32
1.3352 0.41762 0.1744
1.4137 0.69202 0.4789
1.4923 0.80787 0.65265
1.5708 0.77866 0.60631
5
y
z
4
2
y, z
-1
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
x
2.11
>> q0 = 10;R = 60;L = 9;C = 0.00005;
>> t = linspace(0,.8);
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
4
>> q = q0*exp(-R*t/(2*L)).*cos(sqrt(1/(L*C)-(R/(2*L))^2)*t);
>> plot(t,q)
10
-2
-4
-6
-8
-10
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
2.12
>> z = linspace(-5,5);
>> f = 1/sqrt(2*pi)*exp(-z.^2/2);
>> plot(z,f)
>> xlabel('z')
>> ylabel('frequency')
0.4
0.35
0.3
0.25
frequency
0.2
0.15
0.1
0.05
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
z
2.13
>> F = [14 18 8 9 13];
>> x = [0.013 0.020 0.009 0.010 0.012];
>> k = F./x
k=
1.0e+003 *
1.0769 0.9000 0.8889 0.9000 1.0833
>> U = .5*k.*x.^2
U=
0.0910 0.1800 0.0360 0.0450 0.0780
>> max(U)
ans =
0.1800
2.14
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
5
>> TF = 32:3.6:93.2;
>> TC = 5/9*(TF-32);
>> rho = 5.5289e-8*TC.^3-8.5016e-6*TC.^2+6.5622e-5*TC+0.99987;
>> plot(TC,rho)
1.001
0.999
0.998
0.997
0.996
0.995
0.994
0 5 10 15 20 25 30 35
2.15 Script:
clear, clc
format compact
A = [.035 .0001 10 2;
0.02 0.0002 8 1;
0.015 0.001 20 1.5;
0.03 0.0007 24 3;
0.022 0.0003 15 2.5]
U = sqrt(A(:,2))./A(:,1).*(A(:,3).*A(:,4)./(A(:,3)+2*A(:,4))).^(2/3)
Results:
A=
0.035 0.0001 10 2
0.02 0.0002 8 1
0.015 0.001 20 1.5
0.03 0.0007 24 3
0.022 0.0003 15 2.5
U=
0.36241
0.60937
2.5167
1.5809
1.1971
2.16
clear, clc
t = 10:10:60;
c = [3.4 2.6 1.6 1.3 1.0 0.5];
tf = 0:70;
cf = 4.84*exp(-0.034*tf);
plot(t,c,'d','MarkerEdgeColor','r','MarkerFaceColor','r')
hold on
plot(tf,cf,'--g')
xlim([0 75])
hold off
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
6
4.5
3.5
2.5
1.5
0.5
0
0 10 20 30 40 50 60 70
2.17
clear, clc
t = 10:10:60;
c = [3.4 2.6 1.6 1.3 1.0 0.5];
tf = 0:70;
cf = 4.84*exp(-0.034*tf);
plot(t,c,'d','MarkerEdgeColor','r','MarkerFaceColor','r')
hold on
plot(tf,cf,'--g')
xlim([0 75])
hold off
clear, clc
t = 10:10:60;
c = [3.4 2.6 1.6 1.3 1.0 0.5];
tf = 0:70;
cf = 4.84*exp(-0.034*tf);
semilogy(tf,cf,'--g',t,c,'d','MarkerEdgeColor','r','MarkerFaceColor','r')
100
0 10 20 30 40 50 60 70
The result is a straight line. The reason for this outcome can be understood by taking
the natural (Naperian or base-e) logarithm of the function to give,
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
7
Thus, on a semi-log plot, the relationship is a straight line with an intercept of ln 4.84
and a slope of –0.034.
2.18 Script:
clear, clc
format compact
v = 10:10:80;
F = [25 70 380 550 610 1220 830 1450];
vf = 0:100;
Ff = 0.2741*vf.^1.9842;
plot(v,F,'om',vf,Ff,'-.k')
xlabel('v');ylabel('F');
Results:
3000
2500
2000
1500
F
1000
500
0
0 10 20 30 40 50 60 70 80 90 100
v
2.19
clear, clc, format compact
v = 10:10:80;
F = [25 70 380 550 610 1220 830 1450];
vf=logspace(1,2);
Ff = 0.2741*vf.^1.9842;
loglog(v,F,'om',vf,Ff,'-.k')
xlabel('v');ylabel('F');
104
103
F
102
101
101 102
v
The result is a straight line. The reason for this outcome can be understood by taking
the common logarithm of the function to give,
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
8
Thus, on a log-log plot, the slope would be 1.9842 and the intercept would be
log10(0.2741).
2.20 Script:
clear, clc, format compact
x = linspace(0,3*pi/2);
c = cos(x);
cf = 1-x.^2/2+x.^4/factorial(4)-x.^6/factorial(6)+x.^8/factorial(8);
plot(x,c,x,cf,'--')
1.5
0.5
-0.5
-1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
2.21 (a)
>> m=[83.6 60.2 72.1 91.1 92.9 65.3 80.9];
>> vt=[53.4 48.5 50.9 55.7 54 47.7 51.1];
>> g=9.81; rho=1.223;
>> A=[0.455 0.402 0.452 0.486 0.531 0.475 0.487];
>> cd=g*m./vt.^2;
>> CD=2*cd/rho./A
CD =
1.0337 1.0213 0.9877 0.9693 0.9625 0.9693 1.0206
(b)
>> CDmin=min(CD),CDmax=max(CD),CDavg=mean(CD)
CDmin =
0.9625
CDmax =
1.0337
CDavg =
0.9949
(c)
subplot(2,1,1);plot(m,A,'o')
ylabel('area (m^2)')
title('area versus mass')
subplot(2,1,2);plot(m,CD,'o')
xlabel('mass (kg)')ylabel('CD')
title('dimensionless drag versus mass')
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
9
0.5
0.45
0.4
60 65 70 75 80 85 90 95
0.95
60 65 70 75 80 85 90 95
mass (kg)
2.22 (a)
t = 0:pi/64:6*pi;
subplot(2,1,1);plot(t.*cos(6*t),t.*sin(6*t),'r')
title('(a)');xlabel('t cos(6t)');ylabel('t sin(6t)')
subplot(2,1,2);plot3(t.*cos(6*t),t.*sin(6*t),t,'c')
title('(b)');xlabel('t cos(6t)');ylabel('t sin(6t)');zlabel('t')
(a)
20
10
t sin(6t)
-10
-20
-20 -15 -10 -5 0 5 10 15 20
t cos(6t)
(b)
20
10
t
0
20
10 10 20
0 0
-10 -10
-20 -20
t sin(6t) t cos(6t)
(b) Script:
clear, clc, format compact
q = 4:2:12;
r = [7 8 4; 3 6 -5];
sum(q) * r(2, 3)
Results:
ans =
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
10
-200
2.24
clear, clc, format compact
y0=0;v0=28;g=9.81;
x=0:5:80;
theta0=15*pi/180;
y1=tan(theta0)*x-g/(2*v0^2*cos(theta0)^2)*x.^2+y0;
theta0=30*pi/180;
y2=tan(theta0)*x-g/(2*v0^2*cos(theta0)^2)*x.^2+y0;
theta0=45*pi/180;
y3=tan(theta0)*x-g/(2*v0^2*cos(theta0)^2)*x.^2+y0;
theta0=60*pi/180;
y4=tan(theta0)*x-g/(2*v0^2*cos(theta0)^2)*x.^2+y0;
theta0=75*pi/180;
y5=tan(theta0)*x-g/(2*v0^2*cos(theta0)^2)*x.^2+y0;
y=[y1' y2' y3' y4' y5'];
plot(x,y);axis([0 80 0 40])
legend('\it\theta_0 = 15^o','\it\theta_0 =30^o', ...
'\it\theta_0 = 45^o','\it\theta_0 = 60^o','\it\theta_0 = 75^o')
40
= 15o
0
35
=30o
0
30
= 45o
0
= 60o
0
25
= 75o
0
20
15
10
0
0 10 20 30 40 50 60 70 80
2.25
clear, clc, format compact
R=8.314;E=1e5;A=7E16;
Ta=253:8:325;
k=A*exp(-E./(R*Ta));
subplot(1,2,1);plot(Ta,k,'g')
xlabel('Ta');ylabel('k');title('(a) k versus Ta')
subplot(1,2,2);semilogy(1./Ta,k,'r')
xlabel('Ta');ylabel('log(k)');title('(b) log k versus Ta')
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
11
5
100
4
10-1
log(k)
3
k
10-2
2
10-3
1
0 10-4
250 300 350 3 3.5 4
Ta Ta 10-3
The result in (b) is a straight line. The reason for this outcome can be understood by
taking the common logarithm of the function to give,
Thus, a plot of log10k versus 1/Ta is linear with a slope of –(E/R)log10e and an intercept
of log10A.
(a)
(b)
(c)
(d)
(e)
format short g
E=50000*1e3*1e4;I=0.0003;w0=2.5e3*100;L=600/100;dx=10/100;
x=[0:dx:L];
clf
y=w0/(120*E*I*L)*(-x.^5+2*L^2*x.^3-L^4.*x);
theta=w0/(120*E*I*L)*(-5*x.^4+6*L^2*x.^2-L^4);
M=w0/(120*L)*(-20*x.^3+12*L^2*x);
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
12
V=w0/(120*L)*(-60*x.^2+12*L^2);
w=w0/L*x;
subplot(5,1,1)
plot(x,y);grid;ylabel('\ity(x)')
subplot(5,1,2)
plot(x,theta);grid;ylabel('\it\theta(x)')
subplot(5,1,3)
plot(x,M);grid;ylabel('\itM(x)')
subplot(5,1,4)
plot(x,V);grid;ylabel('\itV(x)')
subplot(5,1,5)
plot(x,w);grid;ylabel('\itw(x)')
xlabel('\itx (m)')
0
y(x)
-0.005
-0.01
0 1 2 3 4 5 6
-3
x 10
5
(x)
-5
0 1 2 3 4 5 6
6
x 10
1
M(x)
-1
0 1 2 3 4 5 6
6
x 10
1
V(x)
-1
0 1 2 3 4 5 6
5
x 10
4
w(x)
0
0 1 2 3 4 5 6
x (m)
2.27
clear, clc, format compact
t=[0:1/16:100];
x=sin(t).*(exp(cos(t))-2*cos(4*t)-sin(t/12).^5);
y=cos(t).*(exp(cos(t))-2*cos(4*t)-sin(t/12).^5);
subplot(2,1,1)
plot(t,x,t,y,':');title('(a)');xlabel('t');ylabel('x, y');legend('x','y')
subplot(2,1,2)
plot(x,y);axis square;title('(b)');xlabel('x');ylabel('y')
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.
13
(a)
4
x
x, y 2 y
-2
-4
0 10 20 30 40 50 60 70 80 90 100
t
(b)
4
0
y
-2
-4
-5 0 5
x
2.28
clf
t = 0:pi/32:8*pi;
polar(t,exp(sin(t))-2*cos(4*t)+sin((2*t-pi)/24).^5,'--r')
90 6
120 60
150 30
2
180 0
210 330
240 300
270
© McGraw Hill LLC. All rights reserved. No reproduction or distribution without the prior written consent
of McGraw Hill LLC.