Rolling RMS in Simulink model
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Star Strider
am 2 Mai 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 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!