Question

i would like to find RMS value in frequency domain,i used this site for help

http://www.dsprelated.com/showmessage/123177/1.php

but there it is calculated using FFT,but what if i am using periodgram?instead of this code

X = fft(x)

Parseval's Theorem

sum(x.^2) =  sum(abs(X).^2)/N

RMS == sqrt(sum(x.^2))/N) = sqrt(sum(abs(X/N).^2))

how does code change in case of periodogram?thanks in advance

Was it helpful?

Solution

The periodogram P = P(f) expresses how the power of a signal x = x(t) is distributed across the different frequencies. As such, it can be seen as a function which associates to a frequency f the squared of the absolute value of the Fourier transform of x evaluated at f.

In other words, in terms of your notation, the periodogram of x = x(t) goes as P(f) = |X|^2(f).

As a consequence, the RMS satisfies

 RMS = sqrt(sum(P))/N.

CAVEAT:

I am not quite convinced on your normalization factors. In principle, Parseval's theorem states that the Fourier transform is isometric isomorphism of L^2 to itself. Hence the norm of a signal is preserved once a Fourier transform is done. Nonetheless, different definition of such transformations can lead to different normalization factors (e.g. your 1/N). In a nutshell, attention should be paid to that constant.

OTHER TIPS

It is a very old case, but i did a simple program which calculates the power in time domain and frequency domain. For the calculating RMS value of a signal in frequency domain only the integration of periodogram give the same result as in time domain Below ist the code with comments in polish but variables are in english so You should guess what each line does.

clear all 
clc
N=1024; %liczba próbek sygna?u
f1=5; %cz?stotliwo?ci sk?adowych sinusoidalnych sygna?u
f2=15;
f3=30;
fs=1000; %czestotliwosc próbkowania
td=1/fs; %okres sygnalu
t=(0:N-1)*td;
war=0.8; %wariancja zak?ócenia
sig=sqrt(war); %odchylenie standardowe zak?ócenia
Nf=1024; %liczba próbek transformaty Fouriera
%sygna? losowy i deterministyczny

for i=1:N
 %yn(i)=randn;
 %y(i)=sin(2*pi*f1*td*i) + 0.5*sin(2*pi*f2*td*i) + ...
 %0.25*sin(2*pi*f3*td*i) +sig*randn;

    y(i)=5*sin(2*pi*f1*td*i)+sin(2*pi*f2*td*i);

end

%Obliczenie wartosci skutecznej sygnału


RMS_calc_by_hand=sqrt((1/Nf)*sum(y.^2));
RMS_time_domain=rms(y);

%transformata Fouriera
Y=2*abs(fft(y,Nf))/Nf;
Y=Y(1:Nf/2);


df=fs/Nf;
f=0:df:fs/2-df;
%Inna forma zapisu
%f=df*(0:Nf/2-1); 

% wykres sygnału rzeczywistego
subplot(3,2,1);
plot(t,y);
title('a(t)');
xlabel('t [s]');
ylabel('a [mm/s]');

subplot(3,2,2);
plot(f,Y);
% formatowanie wykresu
title('a(f)');
xlabel('f [Hz]');
ylabel('a [mm/s]');

%gestosc widmowa mocy
subplot(3,2,3);


%PSD
[P,w] = periodogram(y,[],Nf,fs);
plot (w,P);
title('gestosc widmowa mocy periodogram');

RMS_freq_domain =sqrt(trapz(w,P));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top