Saturday, January 6, 2018

fft - Amplitude of the Signal in Frequency Domain different from Time Domain


How does the Amplitude of the Signal is changed when taking the FFT of a Signal,


Have a look,


The amplitude had changed from 2 to 30, enter image description here


and Here is my code for generating the above output,


f=1e3;   %Frequency of Wave
A=2; %Amplitude
Fs = 1e6; %Sampling Frequency

Ts = 1/Fs; %Sampling Rate


t = 10/f; %Time period of 1 Oscillation = 1/f

n = 0:Ts:t; %Generating Samples


x=A*sin(2*pi*f*n);
subplot(2,1 ,1)
plot(x



% 100,000 = Fs
% 10,000 = Length of the Signal
% 100,000/10,000 = 100Hz <- First point in FFT = 100Hz
% 2nd Point = 200Hz
% 3rd Point = 300Hz
% 4th Point = 400Hz
% .
% .
% 10th Point = 1KHz <- Original Signal Frequency


subplot(2,1 ,2)
F=fft(x);
plot(real((F))),grid on
xlim ([0 20])

Answer



You're overlooking four things:



  • The $\frac{1}{FFT\_size}$ normalization coefficient. Some FFT implementations have or do not have this factor. Check the definition of FFT as performed by matlab on the Mathworks site!

  • Why are you looking at the real part only? The amplitude is conveyed by the modulus (magnitude) of the complex number. Here, the real part is 31 but the imaginary part is -10000.


  • A sine wave of amplitude 2 yields two complex exponentials of magnitude 1.

  • Keep in mind that you are not computing the Fourier transform of a sine wave (which goes from minus infinity to infinity), but of a sine waved multiplied by a rectangular window. As a result, you won't find the spectrum of a sine wave, but the spectrum of a sine wave convolved by the spectrum of your aperture (a sinc function for the rectangular window). The energy will bleed over adjacent frequency bins instead of being confined in bin 11. You will need to sum the energy over the adjacent bins to recover all the energy!


Getting back to your example:


abs(F(11)) is 10000. Divide by the sample length and you get a bit less than one (which is the expected value). Sum the small residues across the adjacent bins and you'll get back your expected energy.


No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...