% M-script to calculate the mean
% of a vector X. X must exist before
% running this M-script
%
% Author: Borgo, Soranzo, Grassi 2010

Nelem=length(X);
meanX = 0;

%calculate the X mean
for index=1:Nelem
    meanX=meanX+X(index);
end
meanX=meanX/Nelem;

disp(sprintf('the X mean is %2.2f',meanX));