Rolling RMS in Simulink model
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Star Strider
el 2 de Mayo de 2016
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.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!