STA5107_FRADE_HW1

STA5107_FRADE_HW1 - while intensity>0...

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

View Full Document Right Arrow Icon
STA5107: Dr. Srivastava Homework 1 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 1 Jaime Frade CODE %prob1 clear all T_1 = [1, 0.1, 0.01, 0.001]; n1=size(T_1); for j=1:4; alpha_1 = 1.0; T = T_1(j); s_1 = sqrt(T)*alpha_1; n=10/T; t_1 = (0:s_1:n*s_1); random_u = random( 'uniform' ,0,1,1,n+1); score = zeros(1,n+1); for k=1:n+1; if random_u(k) <=0.5; score(k) = -1; else score(k) = 1; end ; end ; sum_1 = score(1,n+1); for m=2:n+1; sum_1(m) = sum(score(1:m))*s_1; end ; figure(j); stairs(t_1,sum_1); xlabel( 'time' ) ylabel( 'x_t' ) title([ 'Total ' int2str(n) ' Step random walk' ]); hold off ; saveas(figure(j),[ 'Total Step random walk ' int2str(n) '.png' ]) end ; 2. OUTPUT
Background image of page 2
STA5107: Dr. Srivastava Homework 1 Jaime Frade CODE %prob1
Background image of page 3

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

View Full DocumentRight Arrow Icon
STA5107: Dr. Srivastava Homework 1 Jaime Frade clear all %prob2 for n=1:5 hold on function1; end ; function y=function1 intensity=.1; time(1)=0; i=2;
Background image of page 4
Background image of page 5

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

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

Unformatted text preview: while intensity>0 n_1(i-1)=(-1/intensity)*log(rand); time(i)=n_1(i-1)+time(i-1); if time(i)<=100 i=i+1; else break end end for n=1:i-1 f_1(n)=time(n); end n=[0:1:i-2]; figure(1); stairs(f_1,n); xlabel( 'time' ) ylabel( 'count' ) saveas(figure(1),[ 'HW1 prob 2.png' ]) 3. OUTPUT STA5107: Dr. Srivastava Homework 1 Jaime Frade CODE %prob3 STA5107: Dr. Srivastava Homework 1 Jaime Frade intensity = 0.1; for i=1:1000; u_1 = random( 'uniform' ,0,1,i); d_1 =-log(u_1)/intensity; time1 = zeros(1,i); for j=2:i; time1(j) = time1(j-1) + d_1(j-1); end ; sum_1=0; for k=1:i; if time1(k)>=10 && time1(k)<=20; sum_1=sum_1 + 1; else sum_1 = sum_1; end ; end ; ht(i) = sum_1; end ; figure(1) hist(ht); saveas(figure(1),[ 'HW1 prob 3.png' ])...
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 / 6

STA5107_FRADE_HW1 - while intensity>0...

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

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