Docsity

solution accompany applied Nu, Lecture notes of Mechanical Engineering

Partial preview of the text

Download solution accompany applied Nu and more Lecture notes Mechanical Engineering in PDF only on Docsity!

Solutions Manual

to accompany

Applied Numerical Methods

With MATLAB for Engineers and Scientists

Steven C. Chapra

Tufts University

CHAPTER 1

1.1 You are given the following differential equation with the initial condition, v ( t = 0) = 0,

2

v

m

c

g

dt

dv d

Multiply both sides by m / cd

2 g v c

m

dt

dv

c

m

d d

Define a = mg / cd

2 2 a v dt

dv

c

m

d

Integrate by separation of variables,

dt m

c

a v

dv (^) d ∫ ∫

2 2

A table of integrals can be consulted to find that

a

x

a x a

dx (^) 1 2 2

tanh

∫ −

Therefore, the integration yields

t C m

c

a

v

a

d = +

− 1 tanh

If v = 0 at t = 0, then because tanh

  • (0) = 0, the constant of integration C = 0 and the solution is

t m

c

a

v

a

d

− 1 tanh

This result can then be rearranged to yield

= t m

gc

c

gm v

d

d

tanh

1.2 This is a transient computation. For the period from ending June 1:

v m

c g dt

dv ' = −

Applying Laplace transforms,

V

m

c

s

g sV v

Solve for

s c m

v

ss c m

g V '/

The first term to the right of the equal sign can be evaluated by a partial fraction expansion,

s c m

B

s

A

ss c m

g

( '/ ) + ' /

( '/ ) ss c m

As c m Bs

ss c m

g

Equating like terms in the numerators yields

A

m

c g

A B

Therefore,

' c '

mg B c

mg A = =−

These results can be substituted into Eq. (2), and the result can be substituted back into Eq.

(1) to give

s c m

v

s c m

mg c

s

mg c V '/

Applying inverse Laplace transforms yields

c mt cm t e v e c

mg

c

mg v

( '/ ) ('/ ) ( 0 ) ' '

− − = − +

or

( )

c mt c mt e c

mg v v e

( '/ ) ('/ ) 1 '

− − = + −

where the first term to the right of the equal sign is the general solution and the second is the

particular solution. For our case, v (0) = 0, so the final solution is

( )

c mt e c

mg v

('/ ) 1 '

− = −

(b) The numerical solution can be implemented as

v = + −

v = + −

The computation can be continued and the results summarized and plotted as:

t v dv / dt 0 0 9. 2 19.6200 6. 4 32.0374 3. 6 39.8962 2. 8 44.8700 1.

10 48.0179 0.

12 50.0102 0.

Note that the analytical solution is included on the plot for comparison.

The process can be continued to give

t y 0 0

0.5 -0. 1 -0. 1.5 -0. 2 0.

2.5 0. 3 0. 3.5 0. 4 0.

4.5 0. 5 0.

-0.

0

0.

0.

0 1 2 3 4 5

y

t m

c

e c

gm v t

⎟ ⎠

⎞ ⎜ ⎝

−⎛ = −

jumper #1: v t ( 1 e ) 44. 87 m / s

  1. 5

10

  1. 1

  2. 5

= − =

⎟ ⎠

⎜ ⎞ ⎝

−⎛

jumper #2: ( 1 ) 14

75

14 t e

⎟ ⎠

⎜ ⎞ ⎝

−⎛ = −

t e

  1. 18666
  2. 87 52. 5 52. 5

− = −

t e

  1. 18666
  2. 14533

−

t e

  1. 18666 ln 0. 14533 ln

−

t = 10.33 sec

1.8 Q in = Q out

Q 1 = Q 2 + Q 3

30 = 20 + vA 3

10 = 5 A 3

A 3 = 2 m

2

1.9 ∑ Min −∑ Mout = 0

[ 1000 + 1200 +MP+ 50 ] −[ 400 + 200 + 1400 + 200 + 350 ] = 0

Metabolic production = 300 grams

1.10 (^) ∑ %body weight= 60

4. 5 + 4. 5 + 12 + 4. 5 + 1. 5 + IW = 60

% Intracellular water body weight = 33 %

4. 5 + 4. 5 + 12 + 4. 5 + 1. 5 + IW = 60

∑ %body water=^100

7. 5 + 7. 5 + 20 + 7. 5 + 55 + TW = 100

% Transcellular water of body water = 2.5 %

t = 5 10 15 20 25 30

(b) >> x = linspace(-3,3,7)

x = -3 -2 -1 0 1 2 3

2.4 (a)

>> v = -2:.75:

v = -2.0000 -1.2500 -0.5000 0.2500 1.

(b) >> r = 6:-1:

r = 6 5 4 3 2 1 0

>> F = [10 12 15 9 12 16]; >> x = [0.013 0.020 0.009 0.010 0.012 0.010]; >> k = F./x

k = 1.0e+003 * 0.7692 0.6000 1.6667 0.9000 1.0000 1.

>> U = .5k.x.^

U = 0.0650 0.1200 0.0675 0.0450 0.0720 0.

>> max(U)

ans =

>> TF = 32:3.6:93.2; >> TC = 5/9(TF-32); >> rho = 5.5289e-8TC.^3-8.5016e-6TC.^2+6.5622e-5TC+0.99987; >> plot(TC,rho)

>> A = [.035 .0001 10 2; .02 .0002 8 1; .015 .001 20 1.5; .03 .0007 24 3; .022 .0003 15 2.5]

A = 0.0350 0.0001 10.0000 2. 0.0200 0.0002 8.0000 1. 0.0150 0.0010 20.0000 1. 0.0300 0.0007 24.0000 3. 0.0220 0.0003 15.0000 2.

>> U = sqrt(A(:,2))./A(:,1).(A(:,3).A(:,4)./(A(:,3)+2*A(:,4))).^(2/3)

U =

>> t = 10:10:60; >> c = [3.4 2.6 1.6 1.3 1.0 0.5]; >> tf = 0:70; >> cf = 4.84exp(-0.034tf); >> plot(t,c,'s',tf,cf,'--')

>> v = 10:10:80; >> F = [25 70 380 550 610 1220 830 1450]; >> vf = 0:100; >> Ff = 0.2741*vf.^1.9842; >> loglog(v,F,'d',vf,Ff,':')

>> x = linspace(0,3*pi/2); >> c = cos(x); >> cf = 1-x.^2/2+x.^4/factorial(4)-x.^6/factorial(6); >> plot(x,c,x,cf,'--')

3.3 The M-file can be written as

function annualpayment(P, i, n) nn = 1:n; A = Pi(1+i).^nn./((1+i).^nn-1); y = [nn;A]; fprintf('\n year annualpayment\n'); fprintf('%5d %14.2f\n',y);

This function can be used to evaluate the test case,

>> annualpayment(35000,.076,5)

year annualpayment 1 37660. 2 19519. 3 13483. 4 10473. 5 8673.

3.4 The M-file can be written as

function Tavg = avgtemp(Tmean, Tpeak, tstart, tend) omega = 2pi/365; t = tstart:tend; Te = Tmean + (Tpeak-Tmean)cos(omega*(t-205)); Tavg = mean(Te);

This function can be used to evaluate the test cases,

>> avgtemp(5.2,22.1,0,59)

ans = -10.

>> avgtemp(23.1,33.6,180,242)

ans =

3.5 The M-file can be written as

function vol = tankvol(R, d) if d < R vol = pi * d ^ 3 / 3; elseif d <= 3 * R v1 = pi * R ^ 3 / 3; v2 = pi * R ^ 2 * (d - R); vol = v1 + v2; else error('overtop') end

This function can be used to evaluate the test cases,

>> tankvol(1,0.5) ans =

>> tankvol(1,1.2) ans =

>> tankvol(1,3.0) ans =

>> tankvol(1,3.1) ??? Error using ==> tankvol overtop

3.6 The M-file can be written as

function [r, th] = polar(x, y) r = sqrt(x .^ 2 + y .^ 2); if x < 0 if y > 0 th = atan(y / x) + pi; elseif y < 0 th = atan(y / x) - pi; else th = pi; end else if y > 0 th = pi / 2; elseif y < 0 th = -pi / 2; else th = 0; end end th = th * 180 / pi;

This function can be used to evaluate the test cases. For example, for the first case,

>> [r,th]=polar(1,1)

r =

th = 90

The remaining cases are

3.8 The M-file can be written as

function grade = lettergrade(score) if score >= 90 grade = 'A'; elseif score >= 80 grade = 'B'; elseif score >= 70 grade = 'C'; elseif score >= 60 grade = 'D'; else grade = 'F'; end

This function can be tested with a few cases,

>> lettergrade(95) ans = A

>> lettergrade(45) ans = F

>> lettergrade(80) ans = B

3.9 The M-file can be written as

function Manning(A)

A(:,5) = sqrt(A(:,2))./A(:,1).(A(:,3).A(:,4)./(A(:,3)+2*A(:,4))).^(2/3);

fprintf('\n n S B H U\n');

fprintf('%8.3f %8.4f %10.2f %10.2f %10.4f\n',A');

This function can be run to create the table,

>> Manning(A)

n S B H U 0.035 0.0001 10.00 2.00 0. 0.020 0.0002 8.00 1.00 0. 0.015 0.0010 20.00 1.50 2. 0.030 0.0007 24.00 3.00 1. 0.022 0.0003 15.00 2.50 1.

3.10 The M-file can be written as

function beam(x) xx = linspace(0,x); n=length(xx); for i=1:n uy(i) = -5/6.(sing(xx(i),0,4)-sing(xx(i),5,4)); uy(i) = uy(i) + 15/6.sing(xx(i),8,3) + 75sing(xx(i),7,2); uy(i) = uy(i) + 57/6.xx(i)^3 - 238.25.*xx(i); end plot(xx,uy)

function s = sing(xxx,a,n) if xxx > a s = (xxx - a).^n; else s=0; end

This function can be run to create the plot,

>> beam(10)

3.11 The M-file can be written as

function cylinder(r, L) h = linspace(0,2r); V = (r^2acos((r-h)./r)-(r-h).sqrt(2rh-h.^2))L; plot(h, V)

This function can be run to the plot,

>> cylinder(2,5)