Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(DO QUESTION 3 ONLY) 2. Create a file named rand_u.m with the following MATLAB code: N=100; sequence length is 100 rand('state', studentno); Binitialized with your
(DO QUESTION 3 ONLY)
2. Create a file named "rand_u.m" with the following MATLAB code: N=100; sequence length is 100 rand('state', studentno); Binitialized with your ID u=4*rand ([1,N])-1; where the command rand is to generate random numbers uniformly distributed between 0 and 1 and studentno is your student ID number. (a) With the use of the command mean or by other means, compute the sample mean, power and variance of u, defined as: 1 N N n=1 N 1 = I una n=1 N 1 42 - N (un - where un represents the nth element of u. 1 (b) Repeat (a) by using a larger value of N, i.e., N=100000. (C) Compare the results of (a) and (b) with the expected values, namely, mean, power and variance. What are your findings? (d) Transform u to another random variable v=u3. Using the 100000 values of Un in (b) and the command histogram, plott ribution un (e) Derive the probability density function (PDF) of v, and compare with the results obtained in (d). What are your findings? 3. Generate N standard uniform random numbers using rand. Apply the command rand('state', studentno) so that each student will work on a distinct number sequence. (a) Set N = 100. Use these 100 standard uniform random numbers to produce 100 Bernoulli random variables with p=0.3. Plot the probability mass function (PMF) of the produced Bernoulli random variables using the 100 samples. (b) Repeat (a) by using a larger value of N, namely, N = 100000. Compare with the results obtained in (a). What are your findings? (C) Extend the Bernoulli random variable generation to binomial random variables with n = 4 and p=0.3. Write down the steps of binomial random variable generation clearly. Implement your steps using MATLAB and plot the corresponding PMF. What are your findings? 2. Create a file named "rand_u.m" with the following MATLAB code: N=100; sequence length is 100 rand('state', studentno); Binitialized with your ID u=4*rand ([1,N])-1; where the command rand is to generate random numbers uniformly distributed between 0 and 1 and studentno is your student ID number. (a) With the use of the command mean or by other means, compute the sample mean, power and variance of u, defined as: 1 N N n=1 N 1 = I una n=1 N 1 42 - N (un - where un represents the nth element of u. 1 (b) Repeat (a) by using a larger value of N, i.e., N=100000. (C) Compare the results of (a) and (b) with the expected values, namely, mean, power and variance. What are your findings? (d) Transform u to another random variable v=u3. Using the 100000 values of Un in (b) and the command histogram, plott ribution un (e) Derive the probability density function (PDF) of v, and compare with the results obtained in (d). What are your findings? 3. Generate N standard uniform random numbers using rand. Apply the command rand('state', studentno) so that each student will work on a distinct number sequence. (a) Set N = 100. Use these 100 standard uniform random numbers to produce 100 Bernoulli random variables with p=0.3. Plot the probability mass function (PMF) of the produced Bernoulli random variables using the 100 samples. (b) Repeat (a) by using a larger value of N, namely, N = 100000. Compare with the results obtained in (a). What are your findings? (C) Extend the Bernoulli random variable generation to binomial random variables with n = 4 and p=0.3. Write down the steps of binomial random variable generation clearly. Implement your steps using MATLAB and plot the corresponding PMF. What are your findingsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started