function M=rvmoment(X, n) % rvmoment(X, n) generates a column vector of the nth moments of the % experiments of the random variable matrix X s=size(X); M=zeros(s(1), 1); for i=1:s(1), EX=X(i,:); M(i)=sum(EX.^n)/length(EX); end