File Exchange

image thumbnail

Hankel transform

version 1.0 (136 KB) by

Efficient implementations of the Hankel transform and the inverse Hankel transform, respectively.

9 Ratings



View License

The Hankel transform of order n transforms rotationally symmetric inputs in a computationally efficient manner. In particular, the Hankel transform of order 0 is equivalent to the two-dimensional Fourier transform of a rotationally symmetric input. This package contains four implementations of the Hankel transform and the inverse Hankel transform, respectively.

"hat" and "ihat" perform the Hankel transform of order n with a direct integration using a matrix product. "ht" and "iht" perform the Hankel transform of order 0 by integrating the Bessel kernel a priori. "dht" and "idht" implement the quasi-discrete Hankel transform of integer order n. And, last but not least, "fht" and "ifht" implement the quasi fast Hankel transform of order n.

For more implementation details, please refer to the online documentation at

Comments and Ratings (17)

I have got it. For Fourier transform, at least two-fold of the maximum frequency is needed to satisfy the Nyquist conditions. It is the same for the Hankel transform. The above codes didnot consider this ,so the errors can be big.

Thanks for your submissions.But I met a little problems about the inverse hankel transform.
I use a circle function and its tranform function to test the caculations
Codes are as followed
% Verification Inverse Hankel Transform
H=besselj(1,pi*k,1)./(2*pi*k); % Circle function---Hankel Transform
[h I]=ihat(H,pi*k,r,0);

hold on
Codes end!!

Codes begin
%% Verification Hankel Transform
[H I]=hat(h,r,2*pi*k,0);
hold on
Codes end!!

The hankel transform show a very good results with the theoretical results.But for the inverse transform, it show
oscillations all through the results. At some discrete points, it seems to show a bigger oscillation.
I wonder why it come out ? or some wrongness about my codes ??

Ryan Grecco

Ryan Grecco

I am attempting to use the quasi fast Hankel transform (fht.m) to help create a plane wave spectrum representation of a Bessel beam and I'm getting the following error towards the end of my MATLAB code:

Error using feval
Argument must contain a string or function_handle.

Error in fht (line 77)

Error in Bessel_FFT2 (line 30)

I inputted the radially dependent function "h", the maximum radius "R", and the maximum spatial frequency "K" using the following code:

% Initial Beam Parameters
c0 = 299792458; % speed of light in a vacuum
f = 2.45*10^9; % microwave frequency
w = 2*pi*f; % angular frequency
alpha = 0.0174533; % angle
syms r;
R = 25; % maximum radius
kk_z = (w*cos(alpha))/c0; % longitudinal wave number
kk = kk_z/cos(alpha); % wave number
K = w/c0; % maximum spatial frequency
kk_rho = kk*sin(alpha); % radial wave number

% Truncate
N = 2^20; % Number of samples

% Define Arrays
h = zeros(1,N);

% Define electric and magnetic field equations
h = cos(alpha)*besselj(1,r*kk*sin(alpha));


Anyone have any thoughts on how I can alter my code to avoid this error? Any help would be greatly appreciated.


Ahmed Fasih

Link from Wayback Machine: folks, this is why you should put your code on Github. Or something.

Pradeep Kumar

ya d given link is not working n file do't open..

Kyle Wilkin

The link for implementation details is not working. Does anyone have an updated link?

Ruibin Liu

Hi, I used a=[1 0 0 0 0 0 0] as the signal vector and tested it with hat.m just as b=hat(a), and the result is b=[0.5554 0.5554 0.5554 0.5554 0.5554 0.5554 0.5554]. But the inverse transform c=ihat(b) gives out c=[0.3198 0.1040 -0.0382 0.0163 -0.0057 0.0006 0.0005]. Why is that? Why c is not equal to a?


Hi Xuesong. The "Undefined function" is because Matlab will not add folders titled "private" to the search path. Perhaps the name of that folder should be changed.


NN (view profile)

Great Submission, it helped quite a bit.

Xuesong Hu

Hi, when I run the code, it returned to this error "Undefined function 'frdr' for input arguments of type 'double'". Does anyone know how to fix that?

Thank you very much in advance.


Toader (view profile)

I studied hat.m and ihat.m functions. They work fine if the order it's very small, but the more I increase the order it's not working properly. Why?
Thank you.


Seems to work nicely, but what is the scaling for (the absolute value of) the output for ht.m?

Eunmi Choi

Thank you!

MATLAB Release
MATLAB 6.0 (R12)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video