% DFAPPR file dfappr.m Discrete approximation from distribution function % Version of 10/21/95 % Approximate discrete distribution from distribution % function entered as a function of t 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 = [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')