Main Content

besselh

Bessel function of third kind (Hankel function)

Description

H = besselh(nu,Z) computes the Hankel function of the first kind Hν(1)(z)=Jν(z)+iYν(z) for each element in array Z.

example

H = besselh(nu,K,Z) computes the Hankel function of the first or second kind Hν(K)(z), where K is 1 or 2, for each element of array Z.

example

H = besselh(nu,K,Z,scale) specifies whether to scale the Hankel function to avoid overflow or loss of accuracy. If scale is 1, then Hankel functions of the first kind Hν(1)(z) are scaled by eiZ, and Hankel functions of the second kind Hν(2)(z) are scaled by e+iZ.

example

Examples

collapse all

Generate the contour plots of the modulus and phase of the Hankel function H0(1)(z) [1].

Create a grid of values for the domain.

[X,Y] = meshgrid(-4:0.002:2,-1.5:0.002:1.5);

Calculate the Hankel function over this domain and generate the modulus contour plot.

H = besselh(0,X+1i*Y);
contour(X,Y,abs(H),0:0.2:3.2)
hold on

Figure contains an axes object. The axes object contains an object of type contour.

In the same figure, add the contour plot of the phase.

contour(X,Y,rad2deg(angle(H)),-180:10:180)
hold off

Figure contains an axes object. The axes object contains 2 objects of type contour.

Plot the real and imaginary parts of the Hankel function of the second kind and examine their asymptotic behavior.

Calculate the Hankel function of the second kind H0(2)(z)=J0(z)-iY0(z) in the interval [0.1,25].

k = 2;
nu = 0;
z = linspace(0.1,25,200);
H = besselh(nu,k,z);

Plot the real and imaginary parts of the function. In the same figure, plot the linear combination J02(z)+Y02(z), which reveals the asymptotic behavior of the magnitudes of the real and imaginary parts.

plot(z,real(H),z,imag(H))
grid on
hold on
M = sqrt(real(H).^2 + imag(H).^2);
plot(z,M,'--')
legend('$J_0(z)$', '$Y_0(z)$', '$\sqrt{J_0^2 (z) + Y_0^2 (z)}$','interpreter','latex')

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent $J_0(z)$, $Y_0(z)$, $\sqrt{J_0^2 (z) + Y_0^2 (z)}$.

Calculate the exponentially scaled Hankel function H1(2)(z)eiz on the complex plane and compare it to the unscaled function.

Calculate the unscaled Hankel function of the second order on the complex plane. When z has a large positive imaginary part, the value of the function quickly diverges. This phenomenon limits the range of computable values.

k = 2;
nu = 1;
x = -5:0.4:15;
y = x';
z = x + 1i*y;
scaled = 1;
H = besselh(nu,k,z);
surf(x,y,imag(H))
xlabel('real(z)')
ylabel('imag(z)')

Figure contains an axes object. The axes object with xlabel real(z), ylabel imag(z) contains an object of type surface.

Now, calculate H1(2)(z)eiz on the complex plane and compare it to the unscaled function. The scaled function increases the range of computable values by avoiding overflow and loss of accuracy when z has a large positive imaginary part.

Hs = besselh(nu,k,z,scaled);
surf(x,y,imag(Hs))
xlabel('real(z)')
ylabel('imag(z)')

Figure contains an axes object. The axes object with xlabel real(z), ylabel imag(z) contains an object of type surface.

Input Arguments

collapse all

Equation order, specified as a scalar, vector, matrix, or multidimensional array. nu specifies the order of the Hankel function. nu and Z must be the same size, or one of them can be scalar.

Example: besselh(3,Z)

Data Types: single | double

Kind of Hankel function, specified as 1 or 2.

  • If K = 1, then besselh computes the Hankel function of the first kind Hν(1)(z)=Jν(z)+iYν(z).

  • If K = 2, then besselh computes the Hankel function of the second kind Hν(2)(z)=Jν(z)iYν(z).

Example: besselh(nu,2,Z)

Functional domain, specified as a scalar, vector, matrix, or multidimensional array. nu and Z must be the same size, or one of them can be scalar.

Example: besselh(nu,[1-1i 1+0i 1+1i])

Data Types: single | double
Complex Number Support: Yes

Toggle to scale function, specified as one of these values:

  • 0 (default) — No scaling

  • 1 — Scale the output of besselh, depending on the value of K:

    • If K = 1, then scale the Hankel function of the first kind Hν(1)(z) by eiZ.

    • If K = 2, then scale Hankel function of the second kind Hν(2)(z) by e+iZ.

    On the complex plane, Hν(1)(z) overflows when imag(Z) is large and negative. Similarly, Hν(2)(z) overflows when imag(Z) is large and positive. Exponentially scaling the output of besselh is useful in these two cases since the function otherwise quickly loses accuracy or overflows the limits of double precision.

Example: besselh(nu,K,Z,1)

More About

collapse all

Hankel Functions and Bessel’s Equation

This differential equation, where ν is a real constant, is called Bessel's equation:

z2d2ydz2+zdydz+(z2ν2)y=0.

Its solutions are known as Bessel functions.

The Bessel functions of the first kind, denoted Jν(z) and Jν(z), form a fundamental set of solutions of Bessel's equation for noninteger ν. The Bessel functions of the second kind, denoted Yν(z), form a second solution of Bessel's equation—linearly independent of Jν(z)—defined by

Yν(z)=Jν(z)cos(νπ)Jν(z)sin(νπ).

The Bessel functions of the third kind, also called Hankel functions of the first and second kind, are defined by linear combinations of the Bessel functions, where Jν(z) is besselj, and Yν(z) is bessely:

Hν(1)(z)=Jν(z)+iYν(z)Hν(2)(z)=Jν(z)iYν(z).

References

[1] Abramowitz, M., and I.A. Stegun. Handbook of Mathematical Functions. National Bureau of Standards, Applied Math. Series #55, Dover Publications, 1965.

[2] Amos, D. E. “Algorithm 644: A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order.” ACM Transactions on Mathematical Software 12, no. 3 (September 1986): 265–273. https://dl.acm.org/doi/10.1145/7921.214331.

Extended Capabilities

Version History

Introduced before R2006a