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

7 views (last 30 days)
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

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!