# Way to calculate/approximate 2D Fourier transform?

#### TriKri

##### New member
Hi! I have a function for which I need to calculate or at least approximate the 2D Fourier transform, that is, the Fourier transform applied twice on the function but on different variables. The function is tanh(w)/w, where w is the absolute value of the vector (wx, wy). So the function can be written as tanh(sqrt(wx^2+wy^2))/sqrt(wx^2+wy^2) (I'm sorry but I don't know how to get latex working). The variables that are supposed to be used in the Fourier transforms are then wx and wy respectivelly.

The reason I'm asking is because I need to construct a filter that acts on a 2D surface, which filters each frequency w with the factor tanh(w)/w, disregarding of the direction along the surface. If I can only calculate the Fourier transform of the function just gave, I will get a 2d convolution filter which I can use.

Any idéas of how to approximate the 2D Fourier transform of the function? Thanks in advance.

#### CaptainBlack

##### Well-known member
hi! I have a function for which i need to calculate or at least approximate the 2d fourier transform, that is, the fourier transform applied twice on the function but on different variables. The function is tanh(w)/w, where w is the absolute value of the vector (wx, wy). So the function can be written as tanh(sqrt(wx^2+wy^2))/sqrt(wx^2+wy^2) (i'm sorry but i don't know how to get latex working). The variables that are supposed to be used in the fourier transforms are then wx and wy respectivelly.

The reason i'm asking is because i need to construct a filter that acts on a 2d surface, which filters each frequency w with the factor tanh(w)/w, disregarding of the direction along the surface. If i can only calculate the fourier transform of the function just gave, i will get a 2d convolution filter which i can use.

Any idéas of how to approximate the 2d fourier transform of the function? Thanks in advance.

2d FFT

CB

Last edited:

#### TriKri

##### New member
Thank you CB, I tried with the fft2 function in Octave but it's difficult to get an image with good enough resolution when there is a size limit to how large matrixes the program can handle.

Instead, I found this transform: en.wikipedia.org/wiki/Hankel_transform#Relation_to_the_Fourier_transform, which I think I can use in this case since my function is circularly symmetric. I will try to use that instead and see what result I get.

#### CaptainBlack

##### Well-known member
Thank you CB, I tried with the fft2 function in Octave but it's difficult to get an image with good enough resolution when there is a size limit to how large matrixes the program can handle.

Instead, I found this transform: en.wikipedia.org/wiki/Hankel_transform#Relation_to_the_Fourier_transform, which I think I can use in this case since my function is circularly symmetric. I will try to use that instead and see what result I get.
You don't need such a good image since the high frequency components fall off rapidly. The spectrum if not of sufficient resolution can be interpolated (since there is not much information in it)

CB

#### TriKri

##### New member
In order to get a small enough matrix so that it becomes possible to transform it, you either have to sacrifice the resolution or the range of the original function. Both of those options are bad and will make the transformed function deviate from the true value.

#### CaptainBlack

##### Well-known member
In order to get a small enough matrix so that it becomes possible to transform it, you either have to sacrifice the resolution or the range of the original function. Both of those options are bad and will make the transformed function deviate from the true value.
How small is small, the hardware on the not exceptional machines I use will handle 1000x1000 matrix, estimated time is of the order of 100-200 ms

CB

#### CaptainBlack

##### Well-known member
In order to get a small enough matrix so that it becomes possible to transform it, you either have to sacrifice the resolution or the range of the original function. Both of those options are bad and will make the transformed function deviate from the true value.
The alternative is to use the symmetry and convert the FT to polars where you will end up with ... (I forget which, transform and I am not going to look it up as I don't have a suitable reference to hand). Which is probably what the Wiokipedia article you mention is about.

CB

Last edited: