www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/MovingVarianceOfMatrixExample.m

    %% Moving Variance of Matrix
% Compute the three-point centered moving variance for each row
% of a matrix. The window starts on the first row, slides horizontally to
% the end of the row, then moves to the second row, and so on.  The
% dimension argument is two, which slides the window across the columns of
% |A|.  Always specify the normalization factor when specifying the
% dimension.

A = [4 8 6; -1 -2 -3; -1 3 4];
M = movvar(A,3,0,2)