How to find the sliding RMS of a signal by sliding a window one unit at a time along a signal?

8 次查看(过去 30 天)
I have codes to calculate the RMS for each window. But one window starts at the end of the previous window. I am new to MATLAB and I am struggling to modify the for loop such that the window slides along the time axis.
The data is in the form of an excel document with 2 columns that I read using the first few lines in my code.
if true
clear all;
Array=csvread('Pencilbreak-63dB.csv');
col1 = Array(:, 1);
col2 = Array(:, 2);
window = 100;
for i=1:window:length(col1)
RMS(i:i+window-1) = (sum(col2(i:i+window-1).^2)/window)^0.5;
end
plot(col1,RMS)
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by