Page 330 - Applied Numerical Methods Using MATLAB
P. 330
PROBLEMS 319
(ii) Use the routine “bvp4_eig()” with the number of grid points N =
256 to solve the BVP4 (P6.11.9) with x 0 = 0and x f = 2, find the
lowest three angular frequencies (ω i ’s) and plot the corresponding
eigenvector solutions as depicted in Fig. P6.11b.
(c) The Sturm–Liouville Equation
Consider an eigenvalue boundary value problem of solving
d
(f (x)y ) + r(x)y = λq(x)y with y(x 0 ) = 0,y(x f ) = 0
dx
(P6.11.15)
to find y(x) for x ∈ [x 0 ,x f ] with the (possible) angular frequency ω.
In order to use the finite difference method, we divide the solu-
tion interval [x 0 ,x f ]into N subintervals to have the grid points x i =
x 0 + ih = x 0 + i(x f − x 0 )/N, and then we replace the derivatives in
the differential equation and the boundary conditions by their finite
difference approximations (with the step size h/2) to write
f(x i + h/2)y (x i + h/2) − f(x i − h/2)y (x i − h/2)
+ r(x i )y i = λq(x i )y(x i )
2(h/2)
1
h y i+1 − y i h y i − y i−1
f x i + − f x i − + r(x i )y i = λq(x i )y(x i )
h 2 h 2 h
a i y i−1 + b i y i + c i y i+1 = λy i for i = 1, 2,...,N − 1 (P6.11.16)
with
f(x i − h/2) f(x i + h/2) r(x i )
a i = , c i = , and b i = − a i − c i
2
2
h q(x i ) h q(x i ) q(x i )
(P6.11.17)
(i) Compose a routine “sturm()” which implements the above-
mentioned scheme to solve the Sturm–Liouville BVP (P6.11.15).
function [x,Y,ws,eigvals] = sturm(f,r,q,x0,xf,N)
(ii) Use the routine “sturm()” with the number of grid points N = 256
to solve the following BVP2:
d 2
(1 + x )y =−2λy with y(x 0 ) = 0,y(x f ) = 0
dx
(P6.11.18)
Plot the eigenvector solutions corresponding to the lowest three
angular frequencies (ω i ’s).