简体   繁体   中英

correct amplitude of pwelch fft

I have a simple sinus signal with some noise. If I try a simple FFT algorithm I get the amplitude of the signal(23) and the freq(2). If I try the pwelch from Matlab with hanning window I am getting the right freq but the amplitude is wrong. How can I obtain the real amplitude? This is the code I am using for the pwelch:

time = 0:0.01:50;
frequency = 2;
amplitude = 23;
y = amplitude * sin (2 * pi * frequency * time);
y= y + 6 * randn(size(time));
y = y - mean(y);
N = length(y);
Fs = 100;
NFFT = 2^nextpow2(N);
M = 4396;
w = hanning(M);
[Pyy,Fy] = pwelch(y, w,[],M,Fs);
plot(Fy,Pyy);

IMHO, you cannot due to the spectral leakage . If you see the Hanning window that you are using, it is a low pass filter (when centred and normalised). It will reduce the power at the main frequencies and it will introduce power at other frequencies, ie smoothing. But, it is an aperiodic signal with infinite duration in the frequency domain, which cannot be computed.

figure; 
plot(w);
title(['Hanning window with ', num2str(M), 'points']);

在此处输入图片说明

You can read more here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM