How can I use Running RMS block to obtain the running rms of every certain constant number of incoming data samples?

3 views (last 30 days)
I am trying to calculate the RMS of the filtered signal for every 600 samples. I have signals from the Base Workspace and I want the model to output the rms value of the filtered signal for every 600 samples. I am using the Running RMS block from Simulink. However, it seems that the value is not reset at every 600 samples and the running rms is the rms of the whole sequences.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 12 Nov 2013
A simplified scenario for the case could be, I have 1,2,3,4,5,6,7,8,9.10,11,12 as the incoming signal, and I want to calculate the running rms value of the input signal for every 4 samples.  So ideally, I want
at t = 4 output rms([1 2 3 4]);
at t = 8 output rms([5 6 7 8]);
at t = 12 output rms([9 10 11 12]);
Please refer to the attached model for how to achieve this task. A few notes for the model.
1. I specified 'data=1:12' in the Model Property -> Callback -> Init Fcn.
2. Variable 'rms1' outputs the RMS value we wanted. Please note that the first element is '0' because the 'Buffer' block introduces delay of the incoming data (this is why the simulation time is set to 0.15 = 0.01*12 + 0.04) instead of 0.12 (sample rate 0.01).
3. The key is to send the reset signal to the Running RMS block at every 4*Ts. I have used a Pulse Generator with 50% pulse width and 8*Ts period. The Running RMS is reset by either edge of the reset signal (so the reset signal is send every 4*Ts).

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2013b

Community Treasure Hunt

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

Start Hunting!