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

    %% Differences Between Matrix Columns  

%% 
% Create a 3-by-3 matrix, then compute the first-order difference between
% the columns. 
X = [1 3 5;7 11 13;17 19 23];
Y = diff(X,1,2) 

%%
% |Y| is a 3-by-2 matrix.