envelope rms implementation review

19 次查看(过去 30 天)
Gideon Kogan
Gideon Kogan 2020-9-24
编辑: Chunru 2021-11-8
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
"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()

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by