{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# FRADE_STA5107_hw4 - Moeti Ncube STA 5107 Home Assignment#3...

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

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 0 10 20 30 40 50 60 70 80 90 100 0 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 0 10 20 30 40 50 60 70 80 90 100 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 i Relative frequency

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

View Full Document
Moeti Ncube Sta5107 Dr. Anuj Srivastava Initial State J=3 0 10 20 30 40 50 60 70 80 90 100 0 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=4 0 10 20 30 40 50 60 70 80 90 100 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 i Relative frequency
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern