%% Trailing Moving Product of Vector
% Compute the three-point trailing moving product of a row vector. When there are fewer than three elements in the window at the endpoints, take the product over the elements that are available.

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

% Copyright 2012 The MathWorks, Inc.