Home > sp > renewal2.m

renewal2

PURPOSE ^

renewal2.m computes and graphs the renewal function for discrete

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 renewal2.m computes and graphs the renewal function for discrete
 interrenewal times

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % renewal2.m computes and graphs the renewal function for discrete
0002 % interrenewal times
0003 
0004 N = 2000;       % maximum time to look at
0005 
0006 f=zeros(1,N);   % f is defined for times 1, 2, ...
0007 f(73) = 1/4;  
0008 f(97) = 1/4;
0009 f(149) = 1/4;
0010 f(251) = 1/4;   % these are relatively prime
0011 
0012 G = cumsum(f);
0013 R = ones(1,N) + G;  % begin adding terms in the renewal function
0014 
0015 for i=1:28,
0016   h = conv(f,G);
0017   G = h(1:N);
0018   R = R + G;  
0019 end
0020 
0021 subplot(2,2,1)
0022 
0023 plot(t,f);
0024 title('Probability mass function of interarrival time #1');
0025 axis([0 N 0 1.1*max(f)]);
0026 text(500,0.2,'Possible values 73, 97, 149, 251');
0027 
0028 subplot(2,2,3)
0029 
0030 plot(t,R);
0031 title('Renewal function #1');
0032 
0033 %---------------------------------------------------------------------------
0034 
0035 f=zeros(1,N);
0036 f(80) = 1/4;  
0037 f(120) = 1/4;
0038 f(180) = 1/4;
0039 f(220) = 1/4;
0040 
0041 G = cumsum(f);
0042 R = ones(1,N) + G;  % begin adding terms in the renewal function
0043 
0044 for i=1:25,
0045   h = conv(f,G);
0046   G = h(1:N);
0047   R = R + G;  
0048 end
0049 
0050 subplot(2,2,2)
0051 
0052 plot(t,f);
0053 title('Probability mass function of interarrival time #2');
0054 axis([0 N 0 1.1*max(f)]);
0055 text(500,0.2,'Possible values 80, 120, 180, 220');
0056 
0057 subplot(2,2,4)
0058 
0059 plot(t,R);
0060 title('Renewal function #2');
0061

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