% ISIMPLE file isimple.m Calculations for independent simple rv % Version of 5/3/95 X = input('Enter row matrix of X-values '); Y = input('Enter row matrix of Y-values '); PX = input('Enter X probabilities '); PY = input('Enter Y probabilities '); [a,b] = meshgrid(PX,fliplr(PY)); P = a.*b; % Matrix of joint independent probabilities [t,u] = meshgrid(X,fliplr(Y)); % t, u matrices for joint calculations EX = dot(X,PX) % E[X] EY = dot(Y,PY) % E[Y] VX = dot(X.^2,PX) - EX^2 % Var[X] VY = dot(Y.^2,PY) - EY^2 % Var[Y] disp(' Use array operations on matrices X, Y, PX, PY, t, u, and P')