FRADE_STA5107_hw4

FRADE_STA5107_hw4 - Moeti Ncube Sta5107 Dr. Anuj Srivastava...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Moeti Ncube Sta5107 Dr. Anuj Srivastava STA 5107: Home Assignment #3 1. Matlab Code: clear z=100; A=[.5,.5,0,0;.1,.9,0,0;0,0,.3,.7;0,0,.2,.8]; j=1; for i=1:z u=rand; J=find(u<cumsum(A(j,:))); j=min(J); X(i)=j; state1(i)=length(find(X==1))/i; state2(i)=length(find(X==2))/i; state3(i)=length(find(X==3))/i; state4(i)=length(find(X==4))/i; end a=[1:1:100]; hold on plot(a,state1, 'r' ); plot(a,state2, 'b' ); plot(a,state3, 'g' ); plot(a,state4, 'k' ); xlabel( 'i' ) ylabel( 'Relative frequency' ) [v,d]=eig(A'); vectoreig=v(1:4,1)/sum(v(1:4,1)) vectorrf=[state1(z);state2(z);state3(z);state4(z)] Matlab Output: plot of the relative frequencies (versus i) with which the path visits the fours states for i up to 100. Plotted at the 4 possible initial starting positions Initial State J=1 10 20 30 40 50 60 70 80 90 100 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 i Relative frequency Initial State J=2 10 20 30 40 50 60 70 80 90 100 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 i Relative frequency Moeti Ncube Sta5107...
View Full Document

This note was uploaded on 12/14/2011 for the course STAT 5107 taught by Professor Staff during the Fall '09 term at FSU.

Page1 / 5

FRADE_STA5107_hw4 - Moeti Ncube Sta5107 Dr. Anuj Srivastava...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online