envelope rms implementation review

I am trying to implement the moving RMS by Matlab.
x = randn(50, 1);
xRMS = sqrt(movmean(x.^2, 21));
xRMSref = envelope(x, 21, 'rms');
plot(xRMSref,'DisplayName','xRMSref');hold on;plot(xRMS,'DisplayName','xRMS');hold off;
legend()
Why my estimation differs from Matlab's? What actually implemented by Matlab? The algorithm description is not delailed and movrms function is locked...

댓글 수: 1

Nim Pim
Nim Pim 2021년 11월 8일
Hi. I too found that moving RMS function of dsp tool box not giving the correct values. I tried it on a small data set and the manually calculated values were different. So confusing....

댓글을 달려면 로그인하십시오.

답변 (1개)

Chunru
Chunru 2021년 11월 8일
편집: Chunru 2021년 11월 8일

0 개 추천

"envelope" removes the mean first before doing movrms and it restore the mean offset in the end.
If you nake sure the signal is 0-mean, then the results would be quite same.
x = randn(50, 1);
x = x -mean(x);
xRMS = sqrt(movmean(x.^2, 21));
xRMSref = envelope(x, 21, 'rms');
plot(xRMSref,'DisplayName','xRMSref');
hold on;
plot(xRMS,'DisplayName','xRMS');hold off;
legend()

카테고리

제품

질문:

2020년 9월 24일

편집:

2021년 11월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by