Question: ECE 502 Sep 6th Probability and Random Processes Homework Assignment 2 Fall 2016 due Sep 15th Problem 1: (25 points) Model homework problem 10 from
ECE 502 Sep 6th Probability and Random Processes Homework Assignment 2 Fall 2016 due Sep 15th Problem 1: (25 points) Model homework problem 10 from assignment 1 in MATLAB and determine experimentally... a) the probability that the message gets through error free, and b) the probability that the message went through Dallas given that it is error free. The MATLAB function randsrc is an easy way to model this problem in MATLAB, although you may use any code you wish. Type help randsrc at the command line for more information. Your must include your MATLAB script for credit. The script you submit must be a "screen shot" of the actual code; that is, a copy and paste of the monitor screen into Micosoft Word (or other text editior) and the page printed. You may also publish the code directly from MATLAB onto a sheet of paper. You are NOT to re-write the code by hand or a text editor. You must also include a comment statement in your MATLAB code containing your name, the name of the course and the year. You will do this for all scripts you submit in this course. When you start MATLAB and call randsrc, the number returned, and all subsequent numbers, are always the same. While the numbers have random properties relative to each other, you get the same sequence tomorrow as you get today. This allows you to exactly repeat simulations in development work. If you want to randomize every time you start MATLAB, insert one or the other following line of code before the first call to randsrc. >> rand('twister',sum(100*clock)) % Randomize initial session seed >> rng('shuffle') % Randomize initial session seed Unless othewise noted, you will do this for any script you submit for homework or exams that contains a MATLAB call to randsrc, randi, or rand. The "probability experiment" will be run N times N trials in MATLAB, where N is a parameter. For N = 100, 10,000 and 1,000,000, record the experimental estimates for the two probabilities. Do this three times for each value of N in order to get a \"feel\" for the variability in the estimates. Take a screen shot of this data and paste it into your solution (or publish it in MATLAB). But do NOT copy, by hand or by key strokes, this screen data into your homework. I would strongly suggests you initially set N = 10 to develop your script. This way you can easily see the data for all triials on the computer screen. The MATLAB functions find, rand and length should also be useful in this problem. 1 ECE 502 Sep 6th Probability and Random Processes Homework Assignment 2 Fall 2016 due Sep 15th Problem 2 (25 points): You are going to calculate the cdf for a r.v. y sin(2 x) in MATLAB where the r.v. x is uniform in [-1,1]. Clearly, we are going to have to approximate using discrete r.v.'s. a) Create a discrete version of the pdf for x in MATLAB using a spacing, or grid, of 0.01 between the mass points. For the sake of discussion, we will call this vector of values that x takes on xv, and the probability vector xp. Stem this pdf. Label the graph 'pdf x' followed by your name. Label the x-axis 'x'. b) Create the vector of values that y takes on, calling it yv. In order to calculate the cumulative probability distribution for y , consider the following. Suppose we want Fy (0.5) . It follows that a find ( yv 0.5) is a vector containing all the indices in the vector yv such that the value for y is less than or equal to 0.5. But these values must come from the inverse image sub-vector xv(a), and this all must happen with probabilities xp(a). Therefore, sum xp a Fy 0.5 . Create the cdf Fy ( y), 1.2 y 1.2 , and plot it using the stairs command. This is in keeping with the discreet nature of the approximation. Label the graph 'cdf y' followed by your name. Label the x-axis 'y'. c) While the above solution is very intuitive and closely follows theory, it is not the most efficient use of MATLAB. Find Fy ( y ), 1.2 y 1.2 using the MATLAB functions sort and cumsum and plot using the stairs command. Extend the plot out to y 1 .2 by overlaying a straight line using the plot command. Label the graph 'cdf y - from sort' followed by your name, and label the x-axis 'y'. Submit a printout of your actual script and the 3 graphs. Problem 3 (15 points): A coin with probability of heads equal to p is tossed repeatedly until the first head appears. Let the r.v. y be the number of trials that occur until the first head appears. What is Pr{ y 1} ? What is Pr{ y 2} ? What is Pr{ y k} ? What is Pr{ y k} ? What is Fy (k ), k 1 ? Problem 4 (15 points) The r.v. x is uniform in [ 0 , / 2 ) . y g ( x) tan( x) . a) Evaluate Fy ( y ) and graph it in MATLAB for 0 y 14 . Label your graph 'Fy' followed by your name. 2 ECE 502 Sep 6th Probability and Random Processes Homework Assignment 2 Fall 2016 due Sep 15th b) valuate f y ( y ) and graph it in MATLAB for 0 y 14 . Label your graph 'fy' followed by your name. Problem 5 (10 points): The r.v. x is Laplace with pdf f x ( x) 0 . The r.v. y gx . Find f y (y) . | x| , for all x and e 2 Problem 6 (10 points): Starting on the hour, trains leave the station at 10 minute intervals. The cdf for your arrival at the station, starting at noon is as follows... 0, t noon Fx (t ) x / 60, noon t 1 PM 1, t noon What is the probability you will not have to wait more than 5 minutes for a train? 3