movmean
Computes moving average values.
Syntax
m=movmean(x)
m=movmean(x,wlen)
m=movmean(x,[nb,na])
m=movmean(...,dim)
m=movmean(...,dim,'Endpoints',v)
Inputs
- x
 - The data sample.
 - wlen
 - The window length over which to compute means.
 - nb
 - The number of windowed points before the target element.
 - na
 - The number of windowed points after the target element.
 - dim
 - Dimension on which to perform the calculation.
 - v
 - The 'Endpoints' property value.
 
Outputs
- m
 
Examples
x = [1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10];
m = movmean(x, 7)
        m = [Matrix] 1 x 16
2.50000  2.60000  3.00000  3.14286  3.85714  4.14286  4.85714  5.14286  5.85714  6.14286  6.85714  7.14286  7.85714  8.00000  8.40000  8.50000
      x = reshape([1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10;
     2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19]', 1, [], 2);
m = movmean(x, 7, 2, 'Endpoints', 'discard')
        m =
slice(:, :, 1) =
[Matrix] 1 x 10
3.14286  3.85714  4.14286  4.85714  5.14286  5.85714  6.14286  6.85714  7.14286  7.85714
slice(:, :, 2) =
[Matrix] 1 x 10
5.85714  7.14286  7.85714  9.14286  9.85714  11.14286  11.85714  13.14286  13.85714  15.14286Comments
The current implementation does not accomodate NaN values in the data.