About FFT of Exponential decay - two-sided

16 vues (au cours des 30 derniers jours)
Erick Zhou
Erick Zhou le 8 Nov 2018
Dear Forum
I just do the FFT of a Exponential decay - two-sided
Fs=512;
N=2.^12;
t=[-N/Fs/2:1/Fs:N/Fs/2-1/Fs];
S=exp(-2*abs(t));
The FFT is:
Y = fft(S,N);
Ayy = (abs(Y));
Ayy(1)=Ayy(1)/N;% to get the amplitude of zero frequency component
Ayy(2:end)=Ayy(2:end)/(N/2); %to get the amplitude of other frequencies
Ayy=fftshift(Ayy);
F=([-N/2:N/2-1])*Fs/N;
plot(F,Ayy);
My question is the FFT of the Exponential decay - two-sided is not 4/(4+F.^2)(F is the frequency vector) shown as follows:
F=([-N/2:N/2-1])*Fs/N;
Ground_Truth=4./(4+F.^2);
figure;
plot(Ground_Truth);
The Equations of the Exponential decay-two-sided and its corresponding Fourier transform can be found in the website of "Fourier transform of typical signals" as follows: http://fourier.eng.hmc.edu/e101/lectures/handout3/node3.html
Would you please tell me why "Ayy" is different from "Ground_Truth" according to my Matlab code?
Many Thanks Erick

Réponse acceptée

Miriam
Miriam le 8 Nov 2018
Hi Erick,
I think the problem lies in your definition of "Ground_Truth". Based on the website you linked to, it should be defined using angular frequency:
Ground_Truth=4./(4+(2*pi*F).^2);
  2 commentaires
Erick Zhou
Erick Zhou le 9 Nov 2018
Modifié(e) : Erick Zhou le 9 Nov 2018
Thank you, Miriam. Your comment about angular frequency is right. According to your suggestion, I can get a Exponential decay - two-sided form the inverse Fourier transform of the Ground_Truth as follows:
F=([-N/2:N/2-1])*Fs/N;
Ground_Truth=4./(4+(2*pi*F).^2);
figure;
plot(Ground_Truth);
z=ifft(fftshift(Ground_Truth));
z2=fftshift(z);
figure;
plot(z2);
But the amplitude of "Ayy" is still different from the modified "Ground_Truth". Moreover, if I use following codes to modify the amplitude of "Ayy" according to suggestions from internet
Ayy(1)=Ayy(1)/N;% to get the amplitude of zero frequency component
Ayy(2:end)=Ayy(2:end)/(N/2); %to get the amplitude of other frequencies
the curve shape of Ayy is distorted.
Would you please give me some suggestions? Thank you.
Miriam
Miriam le 9 Nov 2018
Hi Erick,
I would suggest normalizing Ayy as follows (after taking the absolute value):
Ayy = Ayy/max(Ayy);
and removing the other two lines modifying amplitude.

Connectez-vous pour commenter.

Plus de réponses (2)

Erick Zhou
Erick Zhou le 10 Nov 2018
Thank you for your suggestion,Miriam.
I am still have the question about how to get the real amplitude of the signal in FFT. From the internet, I found some suggestions as follows: "Some FFTs require dividing by 1/N to represent magnitude "naturally" (which is non-energy preserving). " The above suggestion can be found in the website of "https://dsp.stackexchange.com/questions/14636/how-to-get-the-fft-of-a-sine-wave".
I made a example to identify the suggestion as follows
close all;
Adc=2; % DC signal(zeros frequency signal)
A1=3; %
A2=1.5; %
F1=50; %
F2=75; %
Fs=256; %
P1=-30;
P2=90;
N=256;
t=[0:1/Fs:N/Fs]; %采样时刻
%signal
S=Adc+A1*cos(2*pi*F1*t+pi*P1/180)+A2*cos(2*pi*F2*t+pi*P2/180);
%show signal
plot(S);
title('orignal signal');
figure;
Y = fft(S,N);
Ayy = (abs(Y));
plot(Ayy(1:N));
title('FFT result');
figure;
Ayy=Ayy/(N/2); %to get the real amplitude
Ayy(1)=Ayy(1)/2;
F=([1:N]-1)*Fs/N; %to get the real amplitude
plot(F(1:N/2),Ayy(1:N/2));
title('amplitude-Frequency');
The result demonstrated that the above suggestion is right. But I don't know how to modify the amplitude of my FFT result. Would you please give me some suggestion? Thank you.

Erick Zhou
Erick Zhou le 12 Nov 2018
For Periodic signal, it should be Ayy=Ayy/(N/2); %to get the real amplitude Ayy(1)=Ayy(1)/2;
But for Non-Periodic signal, it should be Ayy=Ayy/Fs;
I don't know the reason, but the result is right according to above code

Produits


Version

R2012a

Community Treasure Hunt

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

Start Hunting!

Translated by