What is the power magnitude in FFT?
조회 수: 11 (최근 30일)
이전 댓글 표시
Hi,
I'm computing the fft with the following code:
%********** Més dades per la FFT ***********************
Fs = 99840; %ho trec del PicoScope
m =length (tensio); %calculo la longitud de les mostres de tensió
n = pow2(nextpow2(m)); %calculo el número de punts a representar
%********** càlcul de la FFT ***********************
y = fft (tensio, n); %DFT (discret fourier transform)
f = (0:n-1)*Fs/n; %rang de freqüències
power = y.*conj(y)/n; %calcula la potència de la DFT
freqNyquist = Fs/2;
%********** càlcul de la FFT centrada ***********************
y0=fftshift(y); %centro la FFT d'y
f0=(-n/2:n/2-1)*Fs/n; %marco el rang de les freqüències
power0 = y0.*conj(y0)/n; %calculo la potència corresponent a la DFT centrada
What is the 'power' magnitude? dB? V? The input signal 'y' is in Volts.
Thanks,
Roser
댓글 수: 0
답변 (1개)
Wayne King
2012년 7월 30일
Hi Roser, "power" is basicially magnitude squared. If you are trying to construct a power spectral density estimate, the units are in V^2/Hz.
Then it is customary to take the logarithm of that because the log is a variance stabilizing transformation for the power spectral density.
The periodogram is a nonparametric estimator of the power spectral density which you can implement using fft() as follows.
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*100*t)+randn(size(t));
xdft = fft(x);
% only use one side because signal is real-valued
xdft = xdft(1:length(x)/2+1);
per = 1/(Fs*length(x))*abs(xdft).^2;
freq = 0:Fs/length(x):Fs/2;
plot(freq,10*log10(per))
xlabel('Hz'); ylabel('dB')
MATLAB additionally scales all the frequencies except 0 and the Nyquist by 2 in a one-sided PSD estimate, so if you want to demonstrate agreemen with:
[Pxx,F] = periodogram(x,rectwin(length(x)),length(x),Fs);
Add the line
per(2:end-1) = 2*per(2:end-1);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!