MATLAB: Relation between fft and rms

fft

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.

Best Answer

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.
Related Question