problem in Hanning window with FFT

16 次查看(过去 30 天)
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
Shoaibur Rahman 2015-1-1
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
  13 个评论
Shoaibur Rahman
Shoaibur Rahman 2015-1-2
编辑:Shoaibur Rahman 2015-1-2
x = 4*cos(2*pi*100*t)+8*cos(2*pi*10*t);
Its amplitude is 12, range is 12*2 = 24
Now lets include the hanning window, say:
h = hann(N); % as you defined N in your code
Now, x.*h' will have a minimum value of -9.8 and a maximum of 12. You can also plot to see this. So, do you want to show amplitude equal to 21.8? If yes, then instead of multiplying by 2, use:
M=(abs(X)/max(abs(X)))*range(ifft(X));
mouh nyquist
mouh nyquist 2015-1-2
thank you for all your helps ; now I understand very well the FFT with hanning window ;thank you again

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by