Home > sp > disc_arrival.m

disc_arrival

PURPOSE ^

disc_arrival.m simulates times of successes in a discrete-time arrival process

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

disc_arrival.m simulates times of successes in a discrete-time arrival process

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %disc_arrival.m simulates times of successes in a discrete-time arrival process
0002 
0003 clf;
0004 
0005 T=1000;      % number of time instants
0006 m=15;        % mean number of arrivals over time N
0007 p=m/T;       % probability of success at each instant
0008 
0009 t=1:T;       % vector of time instants
0010 
0011 for v=1:6
0012 
0013 subplot(6,1,v)
0014 
0015 s=binornd(1,p,1,T); % vector of 0's and 1's for failures and successes
0016 
0017 N=cumsum(s);
0018 
0019 stairs(t,N);  
0020 
0021 xlabel('Times / Trials');
0022 ylabel('Number of successes');
0023 
0024 
0025 end
0026 
0027 break
0028 
0029 hold on
0030 
0031 for a=1:N,
0032   if s(a)==1
0033      plot(a,0,'*');
0034   end
0035 end

Generated on Mon 17-Mar-2008 10:33:42 by m2html © 2003