markov3.m
function [P,v]=markov3(a,b,c,d,e,f,x0,y0) P=[a, b, c; d e f; 1-a-d, 1-b-e, 1-c-f]; x(1:50) = 0; y(1:50) = 0; z(1:50) = 0; v(1) = x0; v(2) = y0; v(3) = 1-x0-y0; for n=1:50 x(n) = v(1); y(n) = v(2); z(n) = v(3); v=P*v; end mplot(1:50,x,1:50,y,1:50,z);
댓글
댓글 쓰기