% RTARRIVAL file rtarrival.m Arrivals in random time % Version of 2/19/98 % Calculates distribution for the number of arrivals, % with waiting time W, in a random time T W = input('Enter discrete approx VALUES of W: '); PW = input('Enter discrete approx PROBABILITIES: '); FT = input('Enter dbn fn for T as a string function of s: '); m = input('Calculate probabilities to N = '); E = zeros(1,m+1); k = 0:m; s = 0; ps = 1; for i = 1:m+1 [s,ps] = mgsum(s,W,ps,PW); F = eval(FT); E(i) = dot(F,ps); end PN = E - [0 E(1:m)]; kPN = [k;PN]'; disp('- - - - ') disp('Probabilities P(N=k) are in PN') disp('To view results k, P(N=k), call for kPN')