%% Centered Moving MAD of Vector
% Compute the three-point centered moving MAD of a row vector. When there are fewer than three elements in the window at the endpoints, compute over the elements that are available.

A = [1 2 4 -1 -2 -3 -1 3 2 1];
M = movmad(A,3)

% Copyright 2012 The MathWorks, Inc.