Fourier transform of a 2D shape

Click For Summary

Discussion Overview

The discussion revolves around the numerical computation of the Fourier transform of a two-dimensional function representing an ellipse in the x-y plane. Participants explore methods for implementing this in MATLAB, contrasting analytical approaches with numerical techniques.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant describes a function of two variables that is 1 inside an ellipse and 0 outside, and proposes an analytical solution involving Bessel functions.
  • Another participant emphasizes the necessity of performing a 2D Fourier transform for a 2D function.
  • There are suggestions to simplify the problem by transforming the ellipse into a circle and using related Bessel functions.
  • One participant recommends using a series of Fourier transforms for numerical computation, while another suggests using MATLAB's built-in function fft2 for efficiency.
  • Clarifications are sought regarding the participant's goals, with some confusion about whether the task is an exercise or a practical application in modeling strain in quantum dots.

Areas of Agreement / Disagreement

Participants generally agree on the need for a 2D Fourier transform but disagree on the best approach to implement it in MATLAB. There is no consensus on whether to use manual computation methods or built-in functions.

Contextual Notes

Participants express uncertainty regarding the clarity of the original question and the specific goals of the MATLAB implementation, which may affect the discussion's direction.

Ben Wilson
Messages
90
Reaction score
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
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)?
 
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 ?
 
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)
 
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
 
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.
 
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.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K