%% Asymptotic Behavior
% 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 H_0^{\left(2\right)} \left(z\right)=J_0 \left(z\right)-iY_0 \left(z\right) in the interval \left\lbrack 0\ldotp 1,\;25\right\rbrack.

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 \sqrt{J_0^2 \left(z\right)+Y_0^2 \left(z\right)}, 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')

% Copyright 2018 The MathWorks, Inc.