MATLAB Homework Set #2 2-2.1 When 10 coins are flipped, the event of interest is the number of heads. Let this number be the random variable. a) Plot the distribution function for this random variable. This refers to the Binomial Random Variable with the probability mass function n nk pmfk p k 1 p , for k 0,1,2,, n k m X E X n p X VARX n p 1 p 2 In flipping coins, we assume that p = q = 0.5. 10 10 1 10 1 10 pmfk 0.5 10 k k 2 k 1024 Binomial Probability 1 0.9 0.8 0.7 Fx (x) 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 Number of Heads (x) 7 8 9 10 Execute Matlab HW_2_2_1.m to generate the above plot. b) What is the probability that the random variable is between 6 and 9 inclusive? Pr(6<=x<=9) = 0.375977 c) What is the probability that the random variable is greater than or equal to eight? Pr(8<=x) = 0.0546875 Use the Matlab pmf variable and sum the correct elements to validate these solutions. Hint: Matlab variables must start at 1 not 0, so for x=ii, with ii=0 to n, use pmf(ii+1). Notes and figures are based on or taken from materials in the course textbook: Probabilistic Methods of Signal and System Analysis (3rd ed.) by George R. Cooper and Clare D. McGillem; Oxford Press, 1999. ISBN: 0-19-512354-9. B.J. Bazuin 1 of 6 ECE 3800 2-2.4 A random variable X has the probability distribution function of the form FX x 0 x 2 A 1 sin b x 2 x 2 1 2 x a) Find the values of A and b that make this a valid probability distribution function. FX 2 A 1 sinb 2 1 FX 2 A 1 sinb 2 0 FX 2 FX 2 2 A 1 Therefore A 1 2 FX 2 A 1 sin b 2 0 sinb 2 1 b2 Therefore FX x 0 2 and b 1 1 sin x 2 x 2 2 4 1 b) Find the probability that X>1 4 x 2 2x Pr X 1 1 FX 1 Pr X 1 1 - FX 1 1 1 1 sin 2 4 1 1 2 2 1 1 1 sin 0.146 2 2 4 4 2 2 2 c) Find the probability that X is negative Pr X 0 FX 0 1 1 Pr X 0 F X 0 1 sin 0 2 2 Execute Matlab HW_2_2_4.m to generate plots of the pdf, CDF, and produce random samples having this distribution. . Pr X 1 1 - FX 1 Notes and figures are based on or taken from materials in the course textbook: Probabilistic Methods of Signal and System Analysis (3rd ed.) by George R. Cooper and Clare D. McGillem; Oxford Press, 1999. ISBN: 0-19-512354-9. B.J. Bazuin 2 of 6 ECE 3800 2-3.2 (a) Find the probability density function of the random variable of Problem 2-2.3 and sketch it. 2-2.3 A probability distribution function for a random variable X has the form Fx x A 1 exp x 1, for 1 x a) For what value of A is this a valid probability distribution function? Fx A 1 exp 1 A 1 0 A 1 b) What is FX(2)? Fx 2 1 exp 2 1 1 exp 1 0.6321 c) What is the probability that the random variable lies in the interval 2<x<∞? Prx 2 1 Fx 2 1 1 exp 2 1 exp 1 0.3679 d) What is the probability that the random variable lies in the interval 1<x<=3? Pr1 x 3 Fx 3 Fx 1 1 exp 3 1 1 exp 1 1 Pr1 x 3 Fx 3 Fx 1 exp0 exp 2 1 0.1353 0.8647 Having solved for A …. Fx x 1 exp x 1, for 1 x dF x d 1 exp x 1 f x x x , for 1 x dx dx exp x 1 f x x for 1 x exp x 1, 1 The Matlab “sketches” are Exponential Probability Density 1 0.9 0.9 0.8 0.8 0.7 0.7 0.6 0.6 fx(x) Fx (x) Exponential Probability Distribution 1 0.5 0.5 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 1 2 3 4 5 6 7 8 9 0 10 1 2 3 4 (x) 5 6 7 8 9 10 (x) b) Using the probability density function, find the probability that the random variables is in the range 2<X<=3. 3 3 Pr2 X 3 f x x dx exp x 1 dx 2 Pr2 X 3 2 exp x 1 exp 3 1 exp 2 1 1 2 3 Notes and figures are based on or taken from materials in the course textbook: Probabilistic Methods of Signal and System Analysis (3rd ed.) by George R. Cooper and Clare D. McGillem; Oxford Press, 1999. ISBN: 0-19-512354-9. B.J. Bazuin 3 of 6 ECE 3800 Pr2 X 3 exp 1 exp 2 0.2325 b) Using the probability density function, find the probability that the random variables is less than 2 or X<2. 2 2 Pr X 2 f x x dx exp x 1 dx 1 1 exp x 1 exp 2 1 exp 1 1 1 1 PrX 2 1 exp 1 0.6321 Execute Matlab HW_2_3_2.m to generate plots of the pdf, CDF, and see how the solutions for part (b) and (c) have been generated. PrX 2 2 Notes and figures are based on or taken from materials in the course textbook: Probabilistic Methods of Signal and System Analysis (3rd ed.) by George R. Cooper and Clare D. McGillem; Oxford Press, 1999. ISBN: 0-19-512354-9. B.J. Bazuin 4 of 6 ECE 3800 2-4.4 A power supply has five intermittent loads connected to it and each load, when in operation, draws a power of 10 W. Each load is in operation only one-quarter of the time and operates independently of all other loads. Recognition: 5 independent events that are either on or off … like flipping coins. These are Bernoulli events resulting in a Binomial distribution when taken as a set of outcomes. The reference to power involves a function g(x) of the random variable. Note that Y g K 10 k n nk pk p k 1 p , k Where for k 0,1,2,, n n=5 and p = 0.25 a) Find the mean value of the power required by the loads. Y E g X g k p k K k 5 1 3 Y E g X 10 k k 0 k 4 4 k 5 5 3 3 p0 1 0.2373 4 1 1 p1 5 4 2 1 3 p3 10 0.0879 4 4 4 3 0.3955 4 2 5 k 1 p4 5 4 3 4 1 3 0.0146 4 5 1 1 3 1 p2 10 0.2637 p5 1 0.0010 4 4 4 1024 1 3 9 27 81 243 1 5 2 10 3 10 45 5 1 Y E g X 10 0 1 1024 1024 1024 1024 1024 1024 5 81 20 27 30 9 20 3 5 1 1280 Y E g X 10 10 10 1.25 12.5 1024 1024 b) find the variance of the power required by the loads. g k Y 2 E gX Y E gX 2 2 2 k 2 p K k 5 1 3 10 k k 0 k 4 4 5 k 2 5 k 2 Notes and figures are based on or taken from materials in the course textbook: Probabilistic Methods of Signal and System Analysis (3rd ed.) by George R. Cooper and Clare D. McGillem; Oxford Press, 1999. ISBN: 0-19-512354-9. B.J. Bazuin 5 of 6 ECE 3800 5 k 5 5 1 3 2 Y 2 E g X 100 k 2 k 0 k 4 4 9 3 1 243 81 27 Y 2 100 0 2 1 12 5 2 2 10 3 2 10 42 5 52 1 1024 1024 1024 1024 1024 1024 5 81 40 27 90 9 80 3 25 1 2560 Y 2 100 100 100 2.5 250 1024 1024 and then k Y2 E g X E g X 2 Y 2 Y 250 12.5 2 93.75 2 c) If the power supply can provide only 40 W, find the probability that it will be overloaded. 23.730469% of the time need 0.0 Watts 39.550781% of the time need 10.0 Watts 26.367188% of the time need 20.0 Watts 8.789063% of the time need 30.0 Watts 1.464844% of the time need 40.0 Watts 0.097656% of the time need 50.0 Watts Therefore, Pr[Y>40]= 0.000977 The average power demand is 12.50 Watts The power variance is 93.750 Watts^2 The variance in power demand is +/- 9.682 Watts Execute Matlab HW_2_4_4.m to perform the computations and provide the desired results. . Notes and figures are based on or taken from materials in the course textbook: Probabilistic Methods of Signal and System Analysis (3rd ed.) by George R. Cooper and Clare D. McGillem; Oxford Press, 1999. ISBN: 0-19-512354-9. B.J. Bazuin 6 of 6 ECE 3800