FFT vs Table Fourier Pairs

2 vues (au cours des 30 derniers jours)
Eugene
Eugene le 5 Fév 2012
Dear friends, I done FFTs of good known functions from Fourier Transform pairs table. The result of FFT doesn't match analytic transform in most cases by magnitude value, and in example 4 also by envelopment form. Code examples below. Where I wrong, please ?
fs=1000; % sampling rate
dt=1/fs; % time step
Sec=5; % Signal length
N=Sec*fs; % number of samples
n=(0:N-1)-N/2;
tn=n*dt; % Time axis
df = fs/N; % Frequency resolution
fk=n*df; % Frecuency axis [Hz]
wk=fk*2*pi; % Angular frequency axis [Rad/sec]
%--------------
% Example 1
% Time domain
alfa=7;
ex1=exp(-alfa.*abs(tn));
% FFT result
Ex1a=fftshift(fft(ifftshift(ex1)));
% Analytics Fourier transform
Ex1b=(2*alfa)./((alfa^2)+(wk.^2));
figure(1);
subplot(3,1,1);
plot(tn,ex1);
grid;
title('e^{-a|t|}');
subplot(3,1,2);
plot(wk,real(Ex1a));
grid;
title('Ex1a');
subplot(3,1,3);
plot(wk,real(Ex1b));
grid;
title('2a/(a^2+w^2)');
%--------------
% Example 2
% Time domain
sigma=0.5;
ex2=exp(-(tn.^2)/(2*(sigma^2)));
% FFT result
Ex2a=fftshift(fft(ifftshift(ex2)));
% Analytics Fourier transform
Ex2b=sigma*sqrt(2*pi)*exp(-(sigma^2).*(wk.^2)/2);
figure(2);
subplot(3,1,1);
plot(tn,ex2);
grid;
title('e^{-t^2/2s^2}');
subplot(3,1,2);
plot(wk,real(Ex2a));
grid;
title('Ex2a');
subplot(3,1,3);
plot(wk,real(Ex2b));
grid;
title('s*sqrt(2pi)*e^{-s^2w^2/2}');
%--------------
% Example 3
% Time domain
ex3=1i./(pi.*tn);
% FFT result
Ex3a=fftshift(fft(ifftshift(ex3)));
% Analytics Fourier transform
Ex3b=-1*(wk<0)+1*(wk>0);
figure(3);
subplot(3,1,1);
plot(tn,abs(ex3));
grid;
title('-i/(t*pi)');
subplot(3,1,2);
plot(wk,real(Ex3a));
grid;
title('Ex3a');
subplot(3,1,3);
plot(wk,real(Ex3b));
grid;
title('(w<0)=>-1;(w>0)=>1');
%--------------
% Example 4
% Time domain
ex4=cos(alfa.*(tn.^2));
% FFT result
Ex4a=fftshift(fft(ifftshift(ex4)));
% Analytics Fourier transform
Ex4b=sqrt(pi/alfa)*cos((wk.^2)/4/alfa-pi/4);
figure(4);
subplot(3,1,1);
plot(tn,ex4);
grid;
title('cos(a*t^2)');
subplot(3,1,2);
plot(wk,abs(Ex4a));
grid;
title('Ex4a');
subplot(3,1,3);
plot(wk,abs(Ex4b));
grid;
title('sqrt(pi/a)*cos(w^2/4a-pi/4)');
%--------------
% Example 5
% Time domain
ex5=2*cos(2*pi*4*tn)+3*cos(2*pi*7*tn);
% FFT result
Ex5a=fftshift(fft(ifftshift(ex5)));
figure(5);
subplot(2,1,1);
plot(tn,ex5);
grid;
title('2cos(4wt)+3cos(7wt)');
subplot(2,1,2);
plot(wk,abs(Ex5a));
grid;
title('Delta(-14pi)+Delta(-8pi)+Delta(8pi)+Delta(14pi)');

Réponse acceptée

Dr. Seis
Dr. Seis le 5 Fév 2012
Multiply your fft result by "dt".
  1 commentaire
Eugene
Eugene le 8 Fév 2012
Dear Elige,
thank you a LOT

Connectez-vous pour commenter.

Plus de réponses (3)

Sadiq Nasser
Sadiq Nasser le 8 Jan 2021
f(t)=cos⁡(10πt-3)e^(-j10ωt)

Sadiq Nasser
Sadiq Nasser le 8 Jan 2021
f(t)=coc^2(10πt-3)e^(-i10ωt)

Sadiq Nasser
Sadiq Nasser le 8 Jan 2021
f(t)=coc^2(10πt-3)e^(-i10ωt)

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by