% SIMPLE file simple.m Calculates basic quantites for simple rv % Version of 6/18/95 X = input('Enter row matrix of X-values '); PX = input('Enter row matrix PX of X probabilities '); n = length(X); % dimension of X EX = dot(X,PX) % E[X] EX2 = dot(X.^2,PX) % E[X^2] VX = EX2 - EX^2 % Var[X] disp(' ') disp('Use row matrices X and PX for further calculations')