3.3 Legendre Functions of Integer Type
45
P42: [2x5 double]
P32: [2x5 double]
P22: [2x5 double]
>> res.P42
ans =
-7.5000
-3.9551
4.2188
9.6387
0
-7.5000
-3.9551
4.2188
9.6387
0
>> res.P32
ans =
0
3.5156
5.6250
4.9219
0
0
-3.5156
-5.6250
-4.9219
0
3.3.2 Application: Spherical Harmonics
The spherical harmonics of degree l and order m
Y
m
l (θ, φ) = (−1)
m
(2l + 1)(l − m)!
4π(l + m)!
P
m
l (cos θ) exp(imφ)
(3.19)
are the solution of the Laplace–Beltrami operator (23.6b) in spherical coordinates (23.5). The spherical harmonics are normalized
Y
m
l (θ, φ)Y
m
l (θ, φ)dΩ = δ l,l δ m,m
(3.20)
with dΩ = sin θdθdφ and hold
Y
−m
l
(θ, φ) = (−1)
m Y
m
l (θ, φ)
∗ ,
(3.21)
with ∗ the complex conjugate.
Due to Eq. (3.19), their computation is straightforward. The function Ylm =
shfun(l,m, theta,phi) returns the values of a spherical harmonic Y m
l (θ, φ)
by calling the class Plm. The input parameters “l,m” are integers, and the angles
“theta” and “phi” are vectors. The output “Ylm” is a two dimensional array with φ
fixed for each row and, respectively, θ in each column.
The function [Ylm, Xout, Yout, Zout] = plotsh(l,m,ax) plots
the absolute value of spherical harmonics in a spherical representation, see Fig. 3.3.
The computation is based on the class legendrefun. “l,m” are the degree and
order and scalar integers. The axes object “ax” (optional) specifies the axes for
plotting. All output values are optional and complex (“Ylm”) or real 2D arrays. For
example, >> surf(abs(Ylm). * X,abs(Ylm). * Y,abs(Ylm). * Z) would
create a figure similar to Fig. 3.3.
45
P42: [2x5 double]
P32: [2x5 double]
P22: [2x5 double]
>> res.P42
ans =
-7.5000
-3.9551
4.2188
9.6387
0
-7.5000
-3.9551
4.2188
9.6387
0
>> res.P32
ans =
0
3.5156
5.6250
4.9219
0
0
-3.5156
-5.6250
-4.9219
0
3.3.2 Application: Spherical Harmonics
The spherical harmonics of degree l and order m
Y
m
l (θ, φ) = (−1)
m
(2l + 1)(l − m)!
4π(l + m)!
P
m
l (cos θ) exp(imφ)
(3.19)
are the solution of the Laplace–Beltrami operator (23.6b) in spherical coordinates (23.5). The spherical harmonics are normalized
Y
m
l (θ, φ)Y
m
l (θ, φ)dΩ = δ l,l δ m,m
(3.20)
with dΩ = sin θdθdφ and hold
Y
−m
l
(θ, φ) = (−1)
m Y
m
l (θ, φ)
∗ ,
(3.21)
with ∗ the complex conjugate.
Due to Eq. (3.19), their computation is straightforward. The function Ylm =
shfun(l,m, theta,phi) returns the values of a spherical harmonic Y m
l (θ, φ)
by calling the class Plm. The input parameters “l,m” are integers, and the angles
“theta” and “phi” are vectors. The output “Ylm” is a two dimensional array with φ
fixed for each row and, respectively, θ in each column.
The function [Ylm, Xout, Yout, Zout] = plotsh(l,m,ax) plots
the absolute value of spherical harmonics in a spherical representation, see Fig. 3.3.
The computation is based on the class legendrefun. “l,m” are the degree and
order and scalar integers. The axes object “ax” (optional) specifies the axes for
plotting. All output values are optional and complex (“Ylm”) or real 2D arrays. For
example, >> surf(abs(Ylm). * X,abs(Ylm). * Y,abs(Ylm). * Z) would
create a figure similar to Fig. 3.3.
