0001
0002
0003
0004 N = 2000;
0005 n = 200;
0006 t = (1:N)/n;
0007
0008
0009
0010 f = unifpdf(t,0,6);
0011 F = cumsum(f)/n;
0012
0013 g = (1-F)/(sum(1-F)/n);
0014
0015 subplot(2,4,1)
0016 plot(t,f);
0017 axis([0 10 0 0.2]);
0018 title('Uniform(0,6) interarrival time');
0019
0020 subplot(2,4,5)
0021 plot(t,g);
0022 title('Remaining lifetime density');
0023
0024
0025
0026 f=zeros(1,N);
0027 f(1:n) = 1:n;
0028 f(3*n+1:4*n) = n:(-1):1;
0029
0030 f = exppdf(t,1);
0031 F = cumsum(f)/n;
0032
0033 g = (1-F)/(sum(1-F)/n);
0034
0035 subplot(2,4,2)
0036 plot(t,f);
0037 title('Exponential(1) interarrival time');
0038
0039 subplot(2,4,6)
0040 plot(t,g);
0041 title('Remaining lifetime density');
0042
0043
0044
0045 f = gampdf(t,4,1);
0046 F = cumsum(f)/n;
0047
0048 g = (1-F)/(sum(1-F)/n);
0049
0050 subplot(2,4,3)
0051 plot(t,f);
0052 title('Gamma(4,1) interarrival time');
0053
0054 subplot(2,4,7)
0055 plot(t,g);
0056 title('Remaining lifetime density');
0057
0058
0059
0060 f = unifpdf(t,8,9);
0061 f(9*n) = 0;
0062 F = cumsum(f)/n;
0063
0064 g = (1-F)/(sum(1-F)/n);
0065
0066 subplot(2,4,4)
0067 plot(t,f);
0068 axis([0 10 0 1.1]);
0069 title('Uniform(8,9) interarrival time');
0070
0071 subplot(2,4,8)
0072 plot(t,g);
0073 title('Remaining lifetime density');
0074