% ACSETUP file acsetup.m Discrete approx from density as string variable % Version of 10/22/94 % Approximate distribution for absolutely continuous rv X % Density is entered as a string variable function of t disp('DENSITY f is entered as a STRING VARIABLE.') disp('either defined previously or upon call.') r = input('Enter matrix [a b] of x-range endpoints '); s = input('Enter number of x approximation points '); d = (r(2) - r(1))/s; t = (r(1):d:r(2)-d) +d/2; m = length(t); f = input('Enter density as a function of t '); PX = eval(f); PX = PX*d; PX = PX/sum(PX); X = t; disp('Distribution is in row matrices X and PX')