ifft in 2D : wrong reasoning ?

7 views (last 30 days)
Olivier
Olivier on 19 Sep 2012
Hi,
I am trying to have a grid in a temporal space from some points in a frequency space in 2D
For example, if I take the point (1,0) in the frequency space, by applying an Inverse Fourier Transform to the matrix representing the space, I should have some vertical lines in the temporal space with a frequency of 1 unit vertically.
Here is a very short code to show my idea :
N=100;
F=zeros(N,N);
F(1,10)=1;
FF=abs(ifft(F));
figure(1)
pcolor(FF)
As a result I have just one vertical line. Furthermore, when I try to change the point with (0,1) for example, I have also a vertical line... But I would like to have a horizontal line, because the periodicity is horizontal.
Could you help me with this problem ? I think the problem comes from my maths and not from matlab...
I have also another question : Is there any easy way to use a continuous space instead than a discrete space (I have a matrix of 100x100 here, I would like to have a continuous space)
Thank a lot.
  1 Comment
Star Strider
Star Strider on 19 Sep 2012
Change:
pcolor(FF)
to:
mesh(FF)
I believe you will find that you have what you expected.
If you have the Symbolic Math Toolbox, you can create a continuous — and analytical — representation of your function.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 19 Sep 2012
True, narrow things in one domain mean wide things in the other. So delta functions in one domain mean infinitely wide things (lines, planes) in the other domain. Still, you need to think a little differently in 2D. A dot (spike, delta function) in 1D gives a single line in 1D spatial domain, and I think you understand that and why that is. However a dot in 2D Fourier domain is a plane in the 2D spatial domain. This would be so much easier to visualize if you had a degree in Optics (like I do) and played around for years in the laser lab, and can visualize the patterns as diffraction patterns - once you get an intuitive feel for thinking like that, it all becomes a lot clearer.
  2 Comments
Olivier
Olivier on 20 Sep 2012
Thank you for this answer. I have tried to replace my delta function by a Gaussian function, but I still don't have any periodicity. I think my reasoning is wrong somewhere but I am stuck.
Here is the code to illustrate what I have done : N=100; F=zeros(N,N);
H=[5,10];
for i=1:N
for j=1:N
F(i,j)=exp(-dot([i,j]-H,[i,j]-H));
end
end
FF=abs(ifft(F));
figure(1)
mesh(FF)
So if it is not working, how can I have a periodic grid from some points (delta function or Gaussian) in the frequency space ?
Thank a lot
Image Analyst
Image Analyst on 20 Sep 2012
To get some kind of oscillation you have to have something that is not smooth. For example, the FT of a square is a 2D sinc function, and the FT of a circle is an airy function (like a Bessel function). But a Gaussian is a special case where it's so smooth, that the FT of a Gaussian is just another Gaussian, so you won't see any periodicity or oscillations at all.
Why don't you just create a bunch of shapes in Photoshop and then, in MATLAB, see what their FT looks like? To maximize your periodic pattern, you want a periodic pattern to start with. Why don't you try an array of spots or squares or rectangles or Gaussians? Remember the FT of a delta function is a plane, but the FT or a 2D comb function (array of delta functions) is a 2D comb function, so an array of rectangles would have an FT that is an array of tiny 2D sinc functions. Try a rectangular array and a honey comb array. See how they're different. Try fading out your image as it gets to the edge. How does that affect it? What if you have a circular or rectangular mask applied to your array? Do you see the airy or 2D sinc function modulating your FT arrays?
You might want to take the log of your FT so that you can see them because often the intensity falls off quite rapidly as you get away from the origin. You might also want to use fftshift() to put your origin in the middle of the image.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!