No BSD License  

Highlights from
An Introduction to Stochastic Processes

image thumbnail
e441_run
function e441_run
%
%  Do Example 4.4.1 - the Cash Balance Problem
%  PC  is the transition matrix of P in canonical form
%
[P]=e441_dat; [g]=mc_equca(P,0); [PC]=mc_canon(P,g);
[m,n]=size(g); [mp,np]=size(PC); ns=mp-n; i=1:ns;
R=PC(n+i,1:n); Q=PC(n+i,n+i); I=eye(ns);
W=inv(I-Q); w=W(5,:); F=W*R; f=F(5,:);
h1=-1:1; h2=11:14; h3=2:10;
f1=f(1,1:3); f2=f(1,4:7); f3=w; ga=6;
h1=ga-h1; h2=h2-ga; c1=1; c2=0.5; c3=0.05; deno=sum(w);
t1=c1*sum(h1.*f1); t2=c2*sum(h2.*f2); t3=c3*sum(h3.*f3);
avg=(t1+t2+t3)/deno;
fprintf('  expected cycle length      = %8.4f \n',deno);
fprintf('  average cost per unit time = %8.4f \n',avg);

Contact us at files@mathworks.com