This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Pstat160 Winter 2009 Homework #6, Matlab part Due: Monday, March 9th Problem 1. Random walks For this problem, you will need the functions randwalk.m, rwpb.m and rwcount.m. Recall that for any functions that gives both outputs and graphs, if you want to see only the graph put a semicolon; after you call this function, without setting a variable for it. For instance, X=randwalk(100,.5); return a graph and all 100 values of the random walk, whereas randwalk(100,.5); returns only the graph. Dont forget the semicolon if you dont want all 100 values on your screen! a) Simulate a random walk using the function randwalk.m. Explain briefly the program. Use p = . 5 ,p = . 4 ,p = . 6 and n = 20 ,n = 100 ,n = 500. Do several runs for each values, and explain. Return only a couple a figures! b) Here we want to test that the theoretical and empirical values for the probability after n steps agree. Use the function rwcount.m for that purpose. Explain briefly the idea of this program. Try for n...
View Full Document
- Spring '09