Applied Numerical Methods With Matlab:
For Engineers & Scientists
By Steven Chapra
4th edition
1
,Chapter 1
1.1 You are given the following differential equation with the initial condition, v(t = 0) = 0,
dv cd
=g− v2
Dt m
Multiply both sides by m/cd
m dv m
= g − v2
Cd dt cd
define a = mg / cd
m dv
= a2 − v2
Cd dt
Integrate by separation of variables,
dv cd
A 2
−v 2
= m dt
A table of integrals can be consulted to find that
Dx 1 x
= tanh−1
a 2
− x2 a a
Therefore, the integration yields
1 v cd
tanh −1 = t +c
A a m
If v = 0 at t = 0, then because tanh–1(0) = 0, the constant of integration c = 0 and the solution
is
1 v cd
tanh −1 = t
A a m
This result can then be rearranged to yield
gm gc
V= tanh d
t
m
cd
1.2 This is a transient computation. For the period from ending june 1:
2
, Balance = previous balance + deposits – withdrawals
balance = 1512.33 + 220.13 – 327.26 = 1405.20
The balances for the remainder of the periods can be computed in a similar fashion as
tabulated below:
Date Deposit Withdrawal Balance
1-may $ 1512.33
$ 220.13 $ 327.26
1-jun $ 1405.20
$ 216.80 $ 378.61
1-jul $ 1243.39
$ 350.25 $ 106.80
1-aug $ 1586.84
$ 127.31 $ 450.61
1-sep $ 1363.54
1.3 At t = 12 s, the analytical solution is 50.6175 (example 1.1). The numerical results are:
Absolute
Step V(12) relative error
2 51.6008 1.94%
1 51.2008 1.15%
0.5 50.9259 0.61%
Where the relative error is calculated with
analytical − numerical
absolute relative error = 100%
analytical
The error versus step size can be plotted as
2.0%
1.0%
relative error
0.0%
0 0.5 1 1.5 2 2.5
Thus, halving the step size approximately halves the error.
1.4 (a) the force balance is
3
, dv c'
=g− v
Dt m
Applying laplace transforms,
g c'
sv − v(0) = − v
S m
Solve for
g
v= +
v(0) (1)
S(s + c' / m) s + c' / m
The first term to the right of the equal sign can be evaluated by a partial fraction expansion,
G a b
= + (2)
S(s + c' / s S + c' / m
m)
G a(s + c' / m) + bs
=
s(s + c' / m) s(s + c' / m)
Equating like terms in the numerators yields
A+ b=0
c'
g= a
m
Therefore,
mg
a=
mg B=−
c' c'
These results can be substituted into eq. (2), and the result can be substituted back into eq.
(1) to give
mg / c' mg / c' v(0)
v= − +
S s + c' / m S + c' / m
Applying inverse laplace transforms yields
mg mg −(c'/ m)t
v= − e + v(0)e −(c'/ m)t
C' c'
Or
4