Fourier transform of a 2D shape

In summary, the author is trying to do a 2D Fourier transform on a function of two variables, but does not understand how to do it in MATLAB.
  • #1
Ben Wilson
90
16
I have a function of 2 variables [f(x,y)] where if there was an ellipse in the x-y plane, all values of the function are 1 inside the ellipse and 0 outside. I can plot this function as a surface in 3d where it looks like an elevated ellipse hovering over an elliptical hole in a sheet.

My problem is this, the Fourier transform of this shape [F(x,y)] can be found analytically by using a new coordinate (e.g. chi = sqrt( ax ^2 + by ^2)), resulting in a bessel function divided by chi [ proportional to J(chi)/chi].

I would like to find F numerically in MATLAB but I have no idea how to do this. Previously I could do FT's of single variable functions ( for instance a boxcar function) by creating a vector x and k and then doing something like this:

for length k
F = 0
for length x
F = F + f*exp(-i k x)
end
end

For two variables however, I created a meshgrid for x and y and defined f using that. Should I do something else?
 
Physics news on Phys.org
  • #2
  • #3
BvU said:
A 2D function merits a 2D Fourier transform !
Indeed. But my question is how to implement this into matlab. I have a vector x, a vector y and a function f formed from the meshgrid[x,y]. how do I do the sums (without using stuff like fft)?
 
  • #4
ehm, perhaps you can reduce your 2D to 1D by compressing your ellipse into a circle (x -> x/a, y-> y/b) . And make use of these Bessel functions that pop up in e.g. fraunhofer diffraction from a circular aperture (matlab example -- but I concede that it isn't doing the Fourier integrals).

But what's wrong with the integrals in post #2 link ?
 
  • #5
As I told you in the other thread (please do not open more than one thread for the same problem), you need to do a series of FTs. Just as you make a FT f(j) → F(i), you will have to do f(j,k) → F(i,k) for each value of k. You then repeat the same procedure on the first index: F(k,j) → FF(k,i).

If your goal is simply to have the FT of f(x,y), you should be doing an FFT, not a FT, and I don't see why you don't simply use the built-in Matlab function fft2:
Matlab:
F = fft2(f)
 
  • #6
DrClaude said:
As I told you in the other thread (please do not open more than one thread for the same problem), you need to do a series of FTs. Just as you make a FT f(j) → F(i), you will have to do f(j,k) → F(i,k) for each value of k. You then repeat the same procedure on the first index: F(k,j) → FF(k,i).

If your goal is simply to have the FT of f(x,y), you should be doing an FFT, not a FT, and I don't see why you don't simply use the built-in Matlab function fft2:
Matlab:
F = fft2(f)

i apologise sir but you simply don't understand my question. hence the new thread haha
 
  • #7
Ben Wilson said:
i apologise sir but you simply don't understand my question. hence the new thread haha
Then try to clarify your question in thread.

From all that you have posted, it appears that you want to do a 2D Fourier transform. I explained how to do it manually in the other thread, thinking that it was part of the exercise for you to do it "from scratch," while here I suggested using FFTs, as it seems you are only interested in the end result.

If this is not what you are after, then please respond with a clearer description of what you are after.
 
  • #8
DrClaude said:
Then try to clarify your question in thread.

From all that you have posted, it appears that you want to do a 2D Fourier transform. I explained how to do it manually in the other thread, thinking that it was part of the exercise for you to do it "from scratch," while here I suggested using FFTs, as it seems you are only interested in the end result.

If this is not what you are after, then please respond with a clearer description of what you are after.
once again haha, i do apologise. Clarity is indeed the issue. I'm not doing an exercise, I'm modelling strain in quantum dots in FORTRAN, and had to quickly run a MATLAB program at the time and couldn't (still can't) for the life of me figure out how to write F(i,j) in matlab, my programs wouldn't run with such obvious syntax.
 

1. What is a Fourier transform of a 2D shape?

The Fourier transform of a 2D shape is a mathematical tool that decomposes a 2D shape into its constituent frequencies. It represents the shape as a combination of sine and cosine waves, allowing for analysis and manipulation of the shape's spatial frequency components.

2. How is the Fourier transform of a 2D shape calculated?

The Fourier transform of a 2D shape is calculated by taking the spatial coordinates of the shape and applying a complex mathematical formula called the Fourier transform. This formula converts the spatial coordinates into a frequency domain representation of the shape.

3. What is the significance of the Fourier transform of a 2D shape in image processing?

The Fourier transform of a 2D shape is widely used in image processing as it allows for efficient analysis and manipulation of images in the frequency domain. By decomposing an image into its frequency components, various image processing techniques such as filtering, compression, and noise reduction can be applied to enhance the image.

4. Can the Fourier transform of a 2D shape be reversed?

Yes, the Fourier transform of a 2D shape can be reversed by applying an inverse Fourier transform. This process converts the frequency domain representation back into the original spatial domain, reconstructing the original 2D shape.

5. Are there any limitations or drawbacks to using the Fourier transform of a 2D shape?

One limitation of the Fourier transform of a 2D shape is that it assumes the shape is continuous and infinite. This may not always be the case for real-world shapes, leading to potential inaccuracies in the transformation. Additionally, the Fourier transform may not be suitable for shapes with sharp edges or discontinuities, as it may result in "ringing" artifacts in the frequency domain.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Differential Equations
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
359
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
999
Replies
2
Views
279
Back
Top