Borrar filtros
Borrar filtros

Why FFT signal power is 3dB higher than definition

18 visualizaciones (últimos 30 días)
CreativeLet
CreativeLet el 18 de Mayo de 2018
Editada: CreativeLet el 1 de Mzo. de 2021
It seems the signal power is 3dB higher than actual power. Does anyone can explain me why?
For example, I have f(t)=A*sin(2*pi*f*t), its power is f(t)^2 integrated over a cycle then divide the cycle period, (1/T*int(f(t)^2)) which is equal to A^2/2 as expected. (match with RMS calculation as well =(A/sqrt(2))^2)
However, both Cadence Virtuoso dft and Matlab FFT give me signal power = A^2.
The way how I calculate the power is as below: I assume the amplitude of the single tone in one bin of FFT results (coherent sampling) is magx. I calculate the power as magx^2.
I have to calculate the power in this way instead of (magx/sqrt(2))^2 because the noise from all other bins are calculated as sum squared. Otherwise, my SNR will be wrong.
From another perspective, it means the noise is also 3dB higher than actual gaussion noise variance value. So the final SNR is correct if I calculate the signal power as magx^2, which is 3dB higher than actual signal power.
I just wonder why there is 3dB difference in fft results compared with actual power, especially for noise? It seems to me the FFT report peak magnitude instead of rms magnitude.
I have the code attached.
%%whether fft give noise in rms or peak, what is the correct snr?
%%SNR/FFT/SFDR/SNDR/noise simulation
%%https://www.mathworks.com/help/signal/ref/snr.html#bt3er4n
%%https://www.mathworks.com/help/matlab/ref/fft.html
clear;close all;
rng default
%rng(1);
FlagTwoTone = false;
tone1 = 53/128*800e6;
Amp = 0.532 * 10^(1.37/20); %input amplitude * PGA gain = 0.623
fs = 800e6;
N = 128;
t = (0:N-1)*1/fs;
freq = fs*(0:(N/2))/N;
noisestd = 300e-6; % assume noise std = 300 uV
sig = Amp*sin(2*pi*tone1*t);
noise = noisestd*randn(size(sig)); %zero mean, variance = noisestd^2
myx = sig + noise;
Tone1dB = 20*log10(Amp/sqrt(2))
noisedB = 20*log10(noisestd)
%deltadB= Tone1dB - noisedB
mySNRviasnr = snr(sig, noise)
Y = fft(myx, N); %length(myx) = N
P2 = abs(Y/N); %double sided fft spectrum, convert complex to mag and then divided by N=128, why divide 128?
P1 = P2(1:N/2+1); %matlab starts with 1
P1(2:end-1) = 2*P1(2:end-1);
modP1 = P1;
figure(1);
plot(freq,P1)
title('Single-Sided Amplitude Spectrum of myx(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
grid on;
simTone1amp = 0;
simTone1index = 0;
simTone1freq = 0;
for i = 1:length(modP1)
if simTone1amp < modP1(i)
simTone1amp = modP1(i);
simTone1index = i;
end
end
%simTone1index
%simTone1amp =P1(simTone1index)
simTone1freq = freq(simTone1index);
modP1(simTone1index) = 0;
simTone1dB = 20*log10(simTone1amp)
if FlagTwoTone %two tones only
simTone2amp = 0;
simTone2index = 0;
simTone2freq = 0;
for i = 1:length(modP1)
if simTone2amp < modP1(i)
simTone2amp = modP1(i);
simTone2index = i;
end
end
simTone2freq = freq(simTone2index);
modP1(simTone2index) = 0;
end
simHarmonicAmp = 0;
simHarmonicIndex = 0;
simHarmonicFreq = 0;
%test = 0;
for i = 1:length(modP1)
%test = test + modP1(i)^2;
if simHarmonicAmp < modP1(i)
simHarmonicAmp = modP1(i);
simHarmonicIndex = i;
end
end
simHarmonicFreq = freq(simHarmonicIndex);
fftTotalNoise = sum(modP1.^2);%sum squared total noises
simNoisedB = 10*log10(fftTotalNoise)
%test
if FlagTwoTone
else
SNDR = 10*log10(simTone1amp^2/fftTotalNoise)
end

Respuesta aceptada

dpb
dpb el 19 de Mayo de 2018
Editada: dpb el 19 de Mayo de 2018
The normalization is all in your code--
P2 = abs(Y/N);
P1 = P2(1:N/2+1);
P1(2:end-1) = 2*P1(2:end-1);
This is the way to normalize a one-sided PSD such that the peak amplitude for a pure signal matches the peak of the signal in time domain; if you want RMS, then that's up to you.
NB: However, this normalization for a single bin works(*) only if the frequency sampling is such the tone of the input signal exactly matches a frequency bin; otherwise the energy will be spread over adjacent bins...discussion/illustration just a few days ago at Answer_319928
(*) That is, the normalization is correct; the maximum amplitude of a single bin in the PSD only matches the time domain peak if the energy is all at the precise bin frequency.
  6 comentarios
CreativeLet
CreativeLet el 25 de Mayo de 2018
Editada: CreativeLet el 25 de Mayo de 2018
I am not introducing RMS(), it's just total power over time (definition of Power) is equivalent to the square of RMS(magnitude).
the SUM(S^2) as Parseval's theorem defines is not the actual power. Even in electrical engineering, people calculate power as SUM(V^2/R). The 1/R is missing from the Parseval's theorem or the general definition of FFT results in Matlab. (see page here for electrical power definition)
From that perspective, SUM(S^2) is a scaled version of power, definitely not the actual power you can measure with an instrument.
It reminds me of physical instrument that can do FFT analysis like oscilloscope/spectrum analyzer. I believe their algorithm will use the below equivalent derived from Parseval's theorem.
SUM(S^2/2) = 1/N * SUM(Y(S)^2/2)
Otherwise, Their FFT/DFT results won't match with time domain power measurement, there will be 3dB difference.
dpb
dpb el 25 de Mayo de 2018
Misunderstood what I was driving at I think; the FFT doesn't know or care about what the input is; which is why there's no 1/R term in the ML version. The instruments are developed "for purpose".
That there needs be a RMS() term for your purpose I'm not disagreeing.

Iniciar sesión para comentar.

Más respuestas (1)

Jesús Lucio
Jesús Lucio el 14 de Sept. de 2020
Hi (2 years late, I know!, but the topic is interesting forever, isn't it?)
Note that 3dB approximately equals 10log10(2), so in "normal" (not dB) units, we are talking of just a factor 2 (instead of a term 3dB). I'm pretty sure it's because actual power is that of two peaks (as the signal is real, then the FFT is symmetric) and possibly you are considering only one (for positive frequencies typically) peak. Can it be that?
  1 comentario
CreativeLet
CreativeLet el 1 de Mzo. de 2021
Editada: CreativeLet el 1 de Mzo. de 2021
that's 6dB difference by your description, 20*log10(2), do you read my code?

Iniciar sesión para comentar.

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by