2
$\begingroup$

I have one quite simple question: how does the amplitude of the signal scale when we do FFT where FFT window length is shorter then duration of the signal? Does this means that if FFT size is 12 time shorter that also amplitude of the signal will scale by 1/12? if so what is the mathematical explanation. Thx in adavance for any reply.

$\endgroup$
1
$\begingroup$

When you perform simple DFT of your signal with length $N$, then you have to scale it properly. Normally it is done by dividing magnitude by length of spectrum vector, which is $N$. Another thing is that normally we are interested in one-sided spectrum, therefore you need to multiply your above result by 2 to compensate energy. This will assure, that values of magnitude are representative.

In case when you are using windows different from rectangular (Hamming, Blackman, etc.) you are not dividing by $N$ - you must scale it by sum of your window samples.

Therefore when you are windowing your signal, you get a new signal with a length of a window. Thus in your case amplitude will be scaled down by 12.

Example for 1Hz sine wave and two window types is shown below. Please note, that frequency axis is chopped at 3Hz. You can see that amplitude of peaks is equal to unit amplitude of signal. Also in case of Hamming window side-lobes are much lower than in case of rectangular, sacrificing main-lobe width at the same time. This can be seen better in logarithmic scale.

enter image description here

MATLAB code used to produce result:

clc, clear all, close all
f0 = 1;        % fundamental frequency
fs = 50;       % sampling frequency
T = 6*pi;      % upper time limit 
t = 0:1/fs:T;  % time vector
N = length(t); % number of samples

% 5 Hz sinusoid with unit amplitude
s = sin(2*pi*f0*t);
% Windowing signal
win = hamming(N)'; 
s_win = s.*win;
% Magnitude spectra
S = abs(fft(s));
S_win = abs(fft(s_win));
% Frequency vector
f = (0:fs/N:round(fs/2));
% Take one-sided spectrum
S_h = 2*S(1:length(f));
S_win_h = 2*S_win(1:length(f));
% Normalisation
S_h = S_h / length(s);
S_win_h = S_win_h / sum(win);
% Time domain signal plots
subplot(2,1,1)
plot(t,s)
xlim([0 T]); grid on; hold on;
plot(t,s_win,'r');
legend({'Rectangular window','Hamming window'})
xlabel('Time'); ylabel('Amplitude')
% Frequency domain plots
subplot(2,1,2)
plot(f, S_h)
grid on; hold on;
plot(f, S_win_h, 'r');
legend({'Rectangular window','Hamming window'})
xlabel('Frequency'); ylabel('Amplitude')
xlim([0 3])
|improve this answer|||||
$\endgroup$
  • $\begingroup$ thank you very much for you answer. I am using rectangular window which is 12 times smaller then duration of my signal.So I am then scaling my amplitude by 1/12N where N is the length (i.e. number os samples) of the signal? $\endgroup$ – Guest2014 Mar 11 '14 at 21:21
  • $\begingroup$ You welcome. The answer is yes - you must then divide it by number of DFT samples. You can easily check that by using code above - it also works in Octave. Good luck! $\endgroup$ – jojek Mar 11 '14 at 21:24
  • $\begingroup$ Just one last clarification - if window size and duration of the signal are the same e.g. equal to N then scaling factor is 1/N. If window size is 12 time shorter then scaling factor is 1/12N?What happens if window size is 12 time longer the the signal? I know that then we do the zero-padding but zer-padding should not change the energy of the signal 8since we are addign just zeros). Should we scale then only over non-padded part, e.g. 1/N (if in this case N is lengths of the signal)? $\endgroup$ – Guest2014 Mar 11 '14 at 21:35
  • $\begingroup$ Ok now I see that I didn't make myself entirely clear. I apologise. I am actually interested in how much amplitudes change when we truncate the signal with rectangular window (which has the size 12 times smaller then duration of the signal) compared to the amplitudes of the original signal (which wasn't truncated). Thus, my assumption is that the new amplitudes will be 12 times smaller? $\endgroup$ – Guest2014 Mar 11 '14 at 21:46
  • $\begingroup$ Yes - peaks will be 12 times smaller. $\endgroup$ – jojek Mar 11 '14 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.