STA5107_FRADE_HW2

STA5107_FRADE_HW2 - STA5107 Dr Srivastava Homework 2 Jaime Frade 1 OUTPUT STA5107 Dr Srivastava Homework 2 Jaime Frade STA5107 Dr Srivastava

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

View Full Document Right Arrow Icon
STA5107: Dr. Srivastava Homework 2 Jaime Frade 1. OUTPUT
Background image of page 1

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

View Full DocumentRight Arrow Icon
STA5107: Dr. Srivastava Homework 2 Jaime Frade
Background image of page 2
STA5107: Dr. Srivastava Homework 2 Jaime Frade CODE clear all clc trans = [0.2 0.2 0.1 0.5; 0.1 0.3 0.4 0.2; 0.3 0.2 0.3 0.2; 0.1 0.3 0.1 0.5]; n=25; state = zeros(4,n); state(:,1) = 0.25*ones; path = zeros(n); for i=1:5; for j=1:n; x = rand; position = find(x<cumsum(state(:,j))); path(j,i) = min(position); state(:,j+1)=trans(path(j,i),:)'; end ; end for n1 = 1:5; figure(n1) hold on ; stairs(path(:,n1)); xlabel( 'time' ) ylabel( 'X(i) state' ) title([ 'Sample path #' int2str(n1)]); saveas(figure(n1),[ 'Sample path ' int2str(n1) '.png' ]) end ; figure(6) hold on ; stairs(path(:,1), ':' ); stairs(path(:,2), '-' ); stairs(path(:,3), '--' ); stairs(path(:,4), '-.' ); stairs(path(:,5), '--.' ); xlabel( 'time' ) ylabel( 'X(i) state' ) title([ 'Sample path #1-5' ]); saveas(figure(6),[ 'Sample paths 1-5.png' ])
Background image of page 3

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

View Full DocumentRight Arrow Icon
Dr. Srivastava Homework 2 Jaime Frade 2. OUTPUT
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the 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 / 8

STA5107_FRADE_HW2 - STA5107 Dr Srivastava Homework 2 Jaime Frade 1 OUTPUT STA5107 Dr Srivastava Homework 2 Jaime Frade STA5107 Dr Srivastava

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

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