{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# STA5107_FRADE_HW3 - STA5107 Dr Srivastava Homework 2 Jaime...

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

STA5107: Dr. Srivastava Homework 2 Jaime Frade 1. OUTPUT

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

View Full Document
STA5107: Dr. Srivastava Homework 2 Jaime Frade
STA5107: Dr. Srivastava Homework 2 Jaime Frade Sample path relative Frequency at i=100 When state= 1 v2_Rel_Freq = 0 0 0.2000 0.8000 When state= 2 v2_Rel_Freq = 0 0 0.2200 0.7800 When state= 3 v2_Rel_Freq = 0.1600 0.8400 0 0 When state= 4 v2_Rel_Freq = 0.1600 0.8300 0 0 >> vectoreig=v(1:4,2)/sum(v(1:4,2)) vectoreig1 = 0.1667 0.8333 0 0 >> vectoreig=v(1:4,4)/sum(v(1:4,4)) vectoreig2 = 0 0 0.2222 0.7778

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

View Full Document
STA5107: Dr. Srivastava Homework 2 Jaime Frade Sample path relative Frequency at i=10000, to display convergence. When state= 1 v2_Rel_Freq = 0 0 0.2234 0.7766 When state= 2 v2_Rel_Freq = 0 0 0.2264 0.7736 When state= 3 v2_Rel_Freq = 0.1627 0.8373 0 0 When state= 4 v2_Rel_Freq = 0.1647 0.8353 0 0 Comment From the setup, one can notice that not all states communicate with each other. The transition matrices is irreducible when separated into two disjoint matrices that within the matrices do communicate with each other. Therefore if the state enters into one of these two matrices, it will continue and remain in the state, as seen in relative frequencies graphs.
STA5107: Dr. Srivastava Homework 2 Jaime Frade CODE %prob1 clear all clc trans = [0.5 0.5 0.0 0.0; 0.1 0.9 0.0 0.0; 0.0 0.0 0.3 0.7; 0.0 0.0 0.2 0.8]; n=100; state = zeros(4,n); path=zeros(n); for i=1:4; rand1 = rand/2; rand2 = rand/2; state(:,1)=[rand1 0.5-rand1 rand2 0.5-rand2]; for j=1:n; x = rand; y = find(x<cumsum(state(:,j))); path(j,i) = min(y); state(:,j+1)=trans(path(j,i),:)'; for k=1:4; count(j,i,k)=length(find(path(1:j,i)==k))/j; end ; end ; end ; for i=1:4; figure(i); stairs(path(:,i)); xlabel( 'time' ) ylabel( 'X(i) state' ) title([ 'Sample Path #' int2str(i)]); saveas(figure(i),[

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 13

STA5107_FRADE_HW3 - STA5107 Dr Srivastava Homework 2 Jaime...

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

View Full Document
Ask a homework question - tutors are online