{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

20061ee131A_1_project1_06

# 20061ee131A_1_project1_06 - 5000 Show your results as a 5...

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

EE 131A Matlab Project 1 Winter 2006 Due March 7th K. Yao The purpose of this project is to learn to generate a uniformly distributed r.v. on (0,1). Let us use the power residue method (also called the multiplicative congruence method) as discussed in our lecture note as well as on p. 71 of the text. Speciﬁcally, s i = 7 5 × s i - 1 mod (2 31 - 1) , i = 1 , 2 , ... (1) x i = s i / (2 31 - 1) , i = 1 , 2 , ... (2) s 0 is the seed between 1 and 2 31 - 1 = 2 , 147 , 483 , 646 and x i is the pseudo-random uniform r.v. over (0 , 1) . The ﬁrst thing to do is to check the algorithm you coded in Matlab is correct. If we take s 0 = 200620062006 , then all of us should obtain x 1 = 0 . 68610781835677 . If you do not obtain this x 1 , then debug your program until you get this number. Next, we want to obtain the sample mean (i.e., ¯ X = (1 /N ) N i =1 x i ), sample second moment (i.e., ¯ X 2 ) = (1 /N ) N i =1 x 2 i , and sample variance (i.e., (1 / ( N - 1)) N i =1 ( x i - ¯ X ) 2 ) of a sequence of x i , i = 1 ,...,N, for N = 1 , 000 : 1000 :
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 5000 . Show your results as a 5 × 4 matrix, with the ﬁrst column giving the n value, the second column the sample mean, the third column the sample second moment, and the fourth column the sample variance. We start with s = 200620062006 , to generate the ﬁrst N = 1000 samples, to evaluate the sample mean, sample second moment, and sample variance. Then use the s 1000 as the seed to generate the second N = 2000 samples, then use the s 2000 as the seed to generate the next N = 3000 samples, etc. How do your sample mean, sample second moment, and sample variance. compare with the theoretical mean, second moment, and variance of this r.v.? Next, repeat the above calculations (i.e., presented as another 5 × 4 matrix) with s taken as the last ﬁve digits of your student ID....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online