What is the power magnitude in FFT?
15 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Wayne King
on 30 Jul 2012
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 Comments
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!