File Exchange

image thumbnail

Hankel transform

version 1.0 (136 KB) by

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

4.55556
9 Ratings

22 Downloads

Updated

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

http://ioalinux1.epfl.ch/~mleutene/MATLABToolbox/HankelTransform.html

Comments and Ratings (18)

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
dx=0.01;
N=2001;
k=eps:(1/dx)/N:(1/dx)*(N-1)/N;
r=0:dx:dx*(N-1);
H=besselj(1,pi*k,1)./(2*pi*k); % Circle function---Hankel Transform
[h I]=ihat(H,pi*k,r,0);

plot(r,h/h(1))
hold on
h1(r<=1)=1;h1(r>1)=0;
plot(r,h1,'r')
Codes end!!

Codes begin
%% Verification Hankel Transform
r=0:0.01:2;
dr=diff(r);
h(r<=1)=1;h(r>1)=0;
N=numel(r);
k=eps:(1/dr(1))/N:(1/dr(1))*(N-1)/N;
[H I]=hat(h,r,2*pi*k,0);
plot(k,H/max(H))
H1=besselj(1,2*pi*k,1)./(2*pi*k);
hold on
plot(k,H1/max(H1),'r')
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

Hello,
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)
h=feval(h,r);

Error in Bessel_FFT2 (line 30)
fht(h,R,K);

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));

fht(h,R,K);

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

Ryan

Ahmed Fasih

Link from Wayback Machine: https://web.archive.org/web/20071228033933/http://ioalinux1.epfl.ch/~mleutene/MATLABToolbox/HankelTransform.html 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?

Spencer

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

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

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.

Michael

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