% DFSETUP file dfsetup.m Discrete approx from string dbn function % Version of 10/21/95 % Approximate discrete distribution from distribution % function entered as string variable function of t disp('DISTRIBUTION FUNCTION F is entered as a STRING') disp('VARIABLE, 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 distribution function F as function of t '); f = eval(F); f = [0 f]; PX = f(2:m+1) - f(1:m); PX = PX/sum(PX); X = t - d/2; disp('Distribution is in row matrices X and PX')