I don't quite get the difference between RMS and a moving RMS. When one calculates RMS, one integrates (or sums in case of a discrete signal) over a period of time(number of samples). When it comes to a moving RMS, I don't quite get the idea why one would use a moving RMS? One last question is what is the difference between a "normal" RMS and a moving RMS with a windows that has an infinite size?
-
$\begingroup$ it's the same difference as the one between an average and a moving average. $\endgroup$– robert bristow-johnsonCommented Jun 28, 2017 at 19:31
-
$\begingroup$ Maybe this question is related to the answer given by hyprfrcb but here goes: What is the difference between "Instantaneous RMS" and RMS. Is instantaneous RMS the same as moving RMS? $\endgroup$– OmiCommented Oct 20, 2017 at 17:43
2 Answers
The total (standard) RMS, continuous time: $$ x_{RMS}=\sqrt{\frac 1{T_0} \int_0^{T_0} x^2(\tau)d\tau} $$
And the moving RMS, continuous time: $$ x_{RMS}(t)=\sqrt{\frac 1{T} \int_{t-T}^t x^2(\tau)d\tau} $$
Are essentially the same operation, the first one taken over the total number of samples $T_0$ and the second taken over a small number of samples $T$.
Note also, the moving operation can be taken at any reference $t$, hence it behaves like an operator, like a filter.
In discrete form, it is only required to exhange the integrator by a sum, and the time with the indexes. The total (standard) RMS, discrete time: $$ x_{RMS}=\sqrt{\frac 1{N_0} \sum_{k=1}^{N_0} x^2[k]} $$
And the moving RMS, discrete time: $$ x_{RMS}[i]=\sqrt{\frac 1{N} \sum_{k=i-N+1}^i x^2[k]} $$
Note that both discrete and continuous tends to be the same quantities, provided that $T=Nd\tau$ with $d\tau$ the sampling time.
-
$\begingroup$ up arrow from me. might wanna include this in discrete-time form (unless the intent of the OP is to do this with op-amps, a capacitor, and a Gilbert cell. $\endgroup$ Commented Jun 28, 2017 at 19:29
-
$\begingroup$ I have a question - is there a recursive form of the moving rms? $\endgroup$ Commented Jun 6, 2019 at 0:41
-
$\begingroup$ Recursive algorithms are simplifications, in order to not execute them fully again. Remember the RMS operation is cheap (compared with other algorithms), and can be executed for every sampling time with no significant computational cost. But you always can obtain a true recursive formula for the RMS value by squaring, multiplying by T, adding the value of the new squared sample, substracting the first squared sample, and then dividing and taking the square root back. $\endgroup$ Commented Jun 6, 2019 at 1:31
-
$\begingroup$ I could pass you the formulas for the discrete and continuous time for the recursive RMS, but i would prefer to put that into a new question. $\endgroup$ Commented Jun 6, 2019 at 1:51
A complement to the previous answer, which is really good.
With a moving-average, or moving-RMS, the output rate of the RMS calculation is the same as the input rate.
With a block average or block RMS, the output rate is lower by a factor of N where N is the number of points you use for your RMS or average.
For example, say you sample a 60-Hz signal at 6000 Hz and you want to calculate the RMS. You would use N = 100. If you use a moving-RMS, you would get a new RMS value every 1/6000 s. While with a block average, you would presumably calculate one RMS value every 60 Hz.