relation between fft and rms
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (2)
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 commentaires
Lian
le 28 Mai 2014
If length(y)=NFFT, then the relationship between rms(y) and rms(Y) is
rms(Y)=rms(y)/sqrt(NFFT)
This is true whether NFFT is odd or even and is readily verifiable by examples,
>> y=rand(1,10); Y=fft(y)/10; rms(y)/sqrt(10), rms(abs(Y))
ans =
0.1852
ans =
0.1852
The relationship to the half spectrum then follows from my original answer above. If length(y)<NFFT, then things are more complicated.
Big dream
le 11 Nov 2016
Thanks for your explanation
Geo
le 10 Mar 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.
Adrian Sanz
le 17 Avr 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);
Catégories
En savoir plus sur Spectral Measurements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!