Thanks for the suggestion! However, I tried to add the circshift function like below, I still get those strips.
With the (1) ftrealgauss, the angle of complexgauss_column, I get
http://picasaweb.google.com/lh/photo/u10dGrh5W0PBKx0V9emaA?feat=directlink
So it was the rings + strips
But then with (2) ftrealgauss, the angle of complexgauss_column became like
http://picasaweb.google.com/lh/photo/Mq9oQrHYkrpwplr1QS0nA?feat=directlink
Or what I've done wrong there?
Thanks in advance!!!
Amy
% my code
dx = 0.15;
K = 256; L = 256;
[X,Y] = meshgrid(((4*K1)/2*dx/4:dx/4:(4*K1)/2*dx/4)dx/8,((4*L1)/2*dx/4:dx/4:(4*L1)/2*dx/4)dx/8);
R = sqrt(X.^2+Y.^2);
realgauss = 1+ (1/(2*sqrt(2*pi)))*exp(R.^2/(4*2^2)); %column width = 2
% from here it's a bit different
% reselect a smaller region (the center region)
realgauss_column = realgauss((513256):(513+255),(513256):(513+255));
% fourier transform (2) is with the circshift
(1) ftrealgauss_column = fftshift(fft2(realgauss_column));
(2) ftrealgauss = circshift(fftshift(fft2(circshift(realgauss_column,[256 256]))),[256 256]);
% the real gauss multiply with another function in fourier space
dg1 = 1/((dx/4)*(4*K+1));
[GX1,GY1] = meshgrid(((4*K1)/2*dg1:dg1:(4*K1)/2*dg1)dg1/2,((4*L1)/2*dg1:dg1:(4*L1)/2*dg1)dg1/2);
G1 = sqrt(GX1.^2+GY1.^2);
G1_c = G1((513256):(513+255),(513256):(513+255));
complexgauss_column = ftrealgauss_column.*exp(i*(pi*10*0.02*G1_c.^2+0.5*pi*0.6*0.02^3*G1_c.^4));
%****************************************************
Jomar Bueyes <jomarbueyes@hotmail.com> wrote in message <5ad17594274549e8884ed30e527b5279@h34g2000yqm.googlegroups.com>...
> On Jan 25, 8:00 am, "Amy Wang" <amy.w...@ua.ac.be> wrote:
> > Dear all,
> >
> > I'm a bit confused when I look at the phase part of the FFT of a gaussian function.
> > As in the code below, I applied fft2 on the gaussian function. The abs(ftrealgauss) is ok, centered at the center. However, when I image the phase of the function imagesc(angle(ftrealgauss)), I get the oscillating circular rings with additional strips at the center. This strip only occurs at pixels close to the center of x and y axis, and it somehow seems like a repeating boundary. Does anyone know how to fix this or the reason to this?
> >
> > % my code
> > dx = 0.15;
> > K = 256; L = 256;
> > [X,Y] = meshgrid(((4*K1)/2*dx/4:dx/4:(4*K1)/2*dx/4)dx/8,((4*L1)/2*dx/4:dx/4:(4*L1)/2*dx/4)dx/8);
> > R = sqrt(X.^2+Y.^2);
> > realgauss = 1+ (1/(2*sqrt(2*pi)))*exp(R.^2/(4*2^2)); %column width = 2
> > ftrealgauss = fftshift(fft2(realgauss));
> > % end my code
> >
> > Many thanks in advance!!!
> >
> > Amy
>
> Hi Amy,
>
> The phase you observe is due to the fact that the peak of the Gaussian
> is located at the center of the array. For discrete Fourier transform
> (DFT) purposes the origin is at the upperleft corner of the array,
> the (1,1) element. That is, what you are seeing is a result of the
> shift property of the DFT. That is, shifting in space is modulating in
> frequency. To avoid that modulation you need to move the peak of the
> Gaussian to the origin and wrap around the samples. This is easily
> done with Matlab's circshift function.
>
> HTH
>
> Jomar
