{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

STA5107_FRADE_HW1

STA5107_FRADE_HW1 - while intensity>0...

Info icon This 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
Image of page 1

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

View Full Document Right 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
Image of page 2
STA5107: Dr. Srivastava Homework 1 Jaime Frade CODE %prob1
Image of page 3

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

View Full Document Right 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;
Image of page 4
Image of page 5

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

View Full Document Right Arrow Icon
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern