{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

160a09_hw5_mat

# 160a09_hw5_mat - Pstat160 Homework#6 Matlab part Due Monday...

This preview shows page 1. Sign up to view the full content.

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. Don’t forget the semicolon if you don’t 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 = 10 , p = . 5 and k = 20 , 100 or 500. Explain. Now change n to be 40, for the same values of k. Can you see any difference and why?
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}