movingwindow#

[moving_statistics] = movingwindow(x, WindowSize, StatisticalMethod, dispout)

Description#

Calculate statistics of moving window through 1-d x data

Inputs#

x

Input data

WindowSize=3;
Window size (number of adjacent elements) that is used for moving window, should be equal or larger than 3
Window size should be an odd integer
StatisticalMethod=’mean’;
Statistical value of moving window to be reported:
‘mean’: Moving mean
‘std’: Moving standard deviation
‘min’: Moving minimum
‘max’: Moving maximum
‘sum’: Moving sum
dispout=’no’;

Define to display outputs or not (‘yes’: display, ‘no’: not display)

Outputs#

moving_statistics

Statistical value of moving window

Examples#

fs=128;
t(:,1)=linspace(0,9.5,10*fs);
x(:,1)=sin(2*pi*0.3*t)+0.1*sin(2*pi*4*t);
[moving_statistics]=movingwindow(x,37,'mean','yes');

References#