relation between fft and rms

165 visualizaciones (últimos 30 días)
Lian
Lian el 27 de Mayo de 2014
Comentada: Geo el 10 de Mzo. de 2023
I'd like to clarify a fundamental issue: what is the relation between fft of a function and its rms value?
Following Matlab example of computing fft of a function:
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
...
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2+1)))
...
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
what is the relation between 2*abs(Y(1:NFFT/2+1)) and rms(Y)?
Many thanks.

Respuesta aceptada

Star Strider
Star Strider el 27 de Mayo de 2014
Editada: Star Strider el 27 de Mayo de 2014
The fft is the (fast) Fourier transform of a signal. It transforms it from a time-comain signal (signal amplitude as a function of time) to a frequency-domain signal, expressing the amplitudes of various components in the signal with respect to their frequencies.
the RMS (root mean squared) value of a signal is a way of expressing its average (mean) power. It is the square root of the mean of the squared value of the signal. For simusiodal signals, the RMS value is 0.707 times the peak-to-peak amplitude of the signal.
For a signal vector s:
RMS = sqrt(mean(x.^2));
The total energy of a signal is preserved under the Fourier transform ( Parseval's theorem ), so the sum (or integral) of the square of a function is equal to the sum (or integral) of the square of its transform. The RMS would be the square root of that value.
  2 comentarios
Lian
Lian el 28 de Mayo de 2014
Thank you Star.
Star Strider
Star Strider el 28 de Mayo de 2014
My pleasure!

Iniciar sesión para comentar.

Más respuestas (2)

Matt J
Matt J el 27 de Mayo de 2014
Editada: Matt J el 28 de Mayo de 2014
For brevity, I define the half-spectrum as
Z=2*abs(Y(1:NFFT/2+1));
I think it helps to start with the identity
rms(Y)= sqrt(sum(abs(Y.^2)))/sqrt(NFFT)
For real-valued initial signal, y, the spectrum Y would be conjugate symmetric and so it would be approximately, but not exactly, true that
sum(abs(Y.^2)) = 2*sum( abs(Y(1:NFFT/2+1)).^2)
= sum(Z.^2)/2
It would be exact if the DC component Y(1) is zero.
Combining the above equations therefore leads to the approximation
rms(Y)= sqrt(sum(Z.^2))/(sqrt(2*NFFT));
EDIT:
Sorry, I just noticed that the above relation is true when NFFT is odd. When it is even, the relation is more complicated. When NFFT is odd, it is easy to verify the above relationship, though:
>> NFFT=31; Y=abs(fft(rand(1,NFFT))); Y(1)=0; Z=2*Y(1:ceil(NFFT/2));
>> rms(Y), sqrt(sum(Z.^2))/(sqrt(2*NFFT))
ans =
1.4291
ans =
1.4291
  4 comentarios
Big dream
Big dream el 11 de Nov. de 2016
Thanks for your explanation
Geo
Geo el 10 de Mzo. de 2023
Hello Matt,
hope you are doing well. Based on your example/explanation that means that rms(Y)=/rms(y), right? Meaning that the RMS of the time domain gives a different value as the RMS of the frequency domain. Only with a difference of 1/sqrt(NFFT) though but still.
Then why are people trying to show that, rms(Y)=rms(y) because of the Parseval's theorem?
Thank you very much in advance.

Iniciar sesión para comentar.


Adrian Sanz
Adrian Sanz el 17 de Abr. de 2017
Hello, I got the case that length(y)<NFFT, how would be the relation? Actually I'm getting NFFT as
NFFT = 2^nextpow2(L);
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);

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