Rolling RMS in Simulink model
이전 댓글 표시
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
2016년 5월 2일
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.
카테고리
도움말 센터 및 File Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!