I have a 60 second waveform I have imported into Simulink. I would like rolling average of the RMS in a 5 second window. Using the RMS block I can find the RMS over the complete signal or find the RMS value with a reset every 5 seconds but not a rolling 5 second window. Any advice on how I could achieve this.
Thanks

답변 (1개)

Star Strider
Star Strider 2016년 5월 2일

0 개 추천

I’m not sure how to do it in Simulink, so you’ll have to adapt this:
t = 0:0.001:60; % Time Vector (Ts = 0.001)
y = sin(2*pi*t/10); % Signal
wndw = 1000; % Averaging Window Length (samples)
rms = sqrt(filter(ones(1,wndw), wndw, y.^2)); % Calculate RMS For Each Sample Window
figure(1)
plot(t, y, t, rms)
grid
With a window length of 1E+4, this eventually gives a straight line with a value of 0.707..., the correct RMS value for a sine function. Experiment with the window length to get the result you want with your signal.

태그

질문:

2016년 5월 2일

답변:

2016년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by