MATLAB Fourier transform of a 2D shape

Click For Summary
SUMMARY

The discussion centers on performing a 2D Fourier transform of a function defined over an elliptical region in MATLAB. The user initially attempts to compute the Fourier transform manually but is advised to utilize the built-in MATLAB function fft2 for efficiency. The conversation highlights the necessity of understanding the transformation process, including the use of meshgrid for defining the function and the importance of clarity in the problem statement. The suggestion to reduce the 2D problem to a 1D case using Bessel functions is also mentioned as a potential approach.

PREREQUISITES
  • Understanding of 2D Fourier transforms
  • Familiarity with MATLAB programming, specifically the fft2 function
  • Knowledge of meshgrid for creating 2D function representations
  • Basic concepts of Bessel functions and their applications in Fourier analysis
NEXT STEPS
  • Research the implementation of fft2 in MATLAB for 2D Fourier transforms
  • Explore the mathematical foundations of Bessel functions and their role in Fourier analysis
  • Learn about meshgrid and its applications in defining multi-variable functions in MATLAB
  • Investigate numerical methods for Fourier transforms beyond built-in functions
USEFUL FOR

Researchers, engineers, and students working in fields such as signal processing, image analysis, or computational physics who require efficient methods for performing 2D Fourier transforms in MATLAB.

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
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
874