Page 464 - Applied Numerical Methods Using MATLAB
P. 464
PROBLEMS 453
(d) Solve the following heat equation with three different boundary condi-
tions by using the three modified routines in (a), (b), (c) with M = 20,N
= 100 and find the maximum absolute errors of the three solutions as in
Problem 9.4(c)(iii).
2
∂ u(x, t) ∂u(x, t)
= for 0 ≤ x ≤ 1, 0 ≤ t ≤ 0.1 (P9.5.6)
∂x 2 ∂t
with the initial/boundary conditions
2
−π t
(i) u(x, 0) = sin(πx), ∂u(x, t)/∂x = πe ,u(x, t) = 0
x=0 x=1
(P9.5.7)
2
−π t
(ii) u(x, 0) = sin(πx), u(x, t) = 0,∂u(x, t)/∂x =−πe
x=0 x=1
(P9.5.8)
2
−π t
(iii) u(x, 0) = sin(πx), ∂u(x, t)/∂x = πe ,
x=0
2
−π t
∂u(x, t)/∂x =−πe (P9.5.9)
x=1
Note that the true analytical solution is
2
u(x, t) = sin(πx)e −π t (P9.5.10)
9.6 Hyperbolic PDEs: Wave Equations
Modify the program “solve_wave.m” (in Section 9.3) so that it can solve
the following PDEs by using the explicit forward Euler method, the implicit
backward Euler method, and the Crank–Nicholson method.
2
2
∂ u(x, t) ∂ u(x, t)
(a) 4 = for 0 ≤ x ≤ 1, 0 ≤ t ≤ 1 (P9.6.1)
∂x 2 ∂t 2
with the initial/boundary conditions
u(x, 0) = 0, ∂u(x, t)/∂t = 5sin(πx),
t=0
u(0,t) = 0, u(1,t) = 0 (P9.6.2)
Note that the true analytical solution is
2.5
u(x, t) = sin(πx) sin(2πt) (P9.6.3)
π
(i) With the solution region divided into M × N = 20 × 50 sections,
2
2
what is the value of r = A( t) /( x) ? Use the MATLAB state-
ments in Problem 9.4(c)(iii) to find the maximum absolute error of
the solution obtained by using the routine “wave()”.

