suppose f(x)=exp(-x^2) then it's fourier transform is also exponential. I'm trying to perform FFT and plot it. I'm using this but it is not showing exponential behavior. please help me with plotting the FFT x=-10:0.01:10; y=exp(-x.^2); N=5000; z=fft(y,N); F=[-N/2:N/2-1]/N; plot(F,z,'b');

# plotting FFT in matlab

Started by ●August 12, 2008

Reply by ●August 12, 20082008-08-12

>suppose f(x)=exp(-x^2) then it's fourier transform is also >exponential. I'm trying to perform FFT and plot it. I'm using this but >it is not showing exponential behavior. please help me with plotting >the FFT > >x=-10:0.01:10; >y=exp(-x.^2); >N=5000; >z=fft(y,N); >F=[-N/2:N/2-1]/N; >plot(F,z,'b'); >First of all, your z is complex, so using a simple plot command is going to give you a warning (I have 2008b, I don't remember how older MATLAB behaves). Next, to get the "standard" view, with 0 Hz in the middle, you should apply an fftshift to whatever component you want to view, e.g., plot(F, real(fftshift(z)), 'b'). If you plot the absolute value of z (abs(fftshift(z))), you'll get a similar exponential shape, btw. Mark

Reply by ●August 12, 20082008-08-12

On Aug 12, 11:46�am, novis <stands...@gmail.com> wrote:> suppose f(x)=exp(-x^2) then it's fourier transform is also > exponential. I'm trying to perform FFT and plot it. I'm using this but > it is not showing exponential behavior. please help �me with plotting > the FFT > > x=-10:0.01:10; > y=exp(-x.^2); > N=5000; > z=fft(y,N); > F=[-N/2:N/2-1]/N; > plot(F,z,'b');Gaussian.

Reply by ●August 12, 20082008-08-12

Reply by ●August 14, 20082008-08-14

On Tue, 12 Aug 2008 08:46:37 -0700 (PDT), novis <standshik@gmail.com> wrote:>suppose f(x)=exp(-x^2) then it's fourier transform is also >exponential. I'm trying to perform FFT and plot it. I'm using this but >it is not showing exponential behavior. please help me with plotting >the FFT > >x=-10:0.01:10; >y=exp(-x.^2); >N=5000; >z=fft(y,N); >F=[-N/2:N/2-1]/N; >plot(F,z,'b');Hi novis, Try the following: clear, clc x = -3:0.1:3; y = exp(-x.^2); figure(1) subplot(3,1,1) plot(x, real(y), '-bo', 'markersize', 2) subplot(3,1,2) plot(x, imag(y), '-bo', 'markersize', 2) N = 1024; z = fft(y,N); Mag = abs(z); Mag_shifted = fftshift(Mag); F = [-N/2:N/2-1]/N; subplot(3,1,3) plot(F, Mag_shifted, 'b'); [-Rick-]