No BSD License  

Highlights from
An Introduction to Stochastic Processes

image thumbnail
[T,t]=e331
function [T,t]=e331
%
%  Simulating mean total life
%  Ref:  Example 3.3.1
%
T=[]; t=[]; rand('seed',12345);
for i=1:10
     st=100.0*i; d=[]; t=[t st]; 
   for n=1:100
      at=0.0;
      while  at <= st
      x=-log(1-rand(1,1)); at=at+x;
      end
   d=[d x];
   end
   m=mean(d); T=[T m];
end
   

Contact us at files@mathworks.com