relation between fft and rms

162 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2014-5-27
编辑:Star Strider 2014-5-27
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 个)

Matt J
Matt J 2014-5-27
编辑:Matt J 2014-5-28
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 个评论
Big dream
Big dream 2016-11-11
Thanks for your explanation
Geo
Geo 2023-3-10
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
Adrian Sanz 2017-4-17
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);

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by