# problem in Hanning window with FFT

78 views (last 30 days)
mouh nyquist on 1 Jan 2015
Commented: mouh nyquist on 2 Jan 2015
where is the error in my program, why I don't get the amplitude is not 4 .
fs=300;
N=3000;
t = (1:N)/fs; % Time vector
x = 4*cos(2*pi*100*t);
% FFT
fn=hanning(N); %fenetre de hanning
ft=abs(fft(x'.*fn));%fft
plot(ft);

Shoaibur Rahman on 1 Jan 2015
Here are few things: Your plot shows the amplitude of Fourier transform, not the original signal. So, the amplitude may not be 4 (amplitude of the signal). Indeed, the amplitude of fft is determined so that the power of the signal remains same before and after the transform. Lets say, Y = x'.*fn
Y = x'.*fn;
Power_Y = sum(Y.^2) % power in time domain
fftY = fft(Y);
Power_fftY = sum(fftY.*conj(fftY))/length(fftY) % power in frequency domain
The amplitude after transformation is set so that Power_Y = Power_fftY
To get the amplitude back, use ifft that is shown in subplot(313) below. Compare these three plots:
subplot(311), plot(Y); % original signal
subplot(312), plot(abs(fftY)); % fft
subplot(313), plot(ifft(fftY)); % ifft
mouh nyquist on 2 Jan 2015
thank you for all your helps ; now I understand very well the FFT with hanning window ;thank you again