Docsity

probability and stochastic process, Exercises of Applied Mathematics

Toggle sidebar
bg1
Probability and Stochastic Processes
A Friendly Introduction for Electrical and Computer Engineers
Second Edition
Quiz Solutions
Roy D. Yates and David J. Goodman
May 22, 2004
•The MATLAB section quizzes at the end of each chapter use programs available for
download as the archive matcode.zip. This archive has programs of general pur-
pose programs for solving probability problems as well as specific .m files associated
with examples or quizzes in the text. Also available is a manual probmatlab.pdf
describing the general purpose .m files in matcode.zip.
•We have made a substantial effort to check the solution to every quiz. Nevertheless,
there is a nonzero probability (in fact, a probability close to unity) that errors will be
found. If you find errors or have suggestions or comments, please send email to
When errors are found, corrected solutions will be posted at the website.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53

Partial preview of the text

Download probability and stochastic process and more Exercises Applied Mathematics in PDF only on Docsity!

Probability and Stochastic Processes

A Friendly Introduction for Electrical and Computer Engineers

Second Edition

Quiz Solutions

Roy D. Yates and David J. Goodman

May 22, 2004

  • The M ATLAB section quizzes at the end of each chapter use programs available for download as the archive matcode.zip. This archive has programs of general pur- pose programs for solving probability problems as well as specific .m files associated with examples or quizzes in the text. Also available is a manual probmatlab.pdf describing the general purpose .m files in matcode.zip.
  • We have made a substantial effort to check the solution to every quiz. Nevertheless, there is a nonzero probability (in fact, a probability close to unity) that errors will be found. If you find errors or have suggestions or comments, please send email to

[email protected].

When errors are found, corrected solutions will be posted at the website.

Quiz Solutions – Chapter 1

Quiz 1. In the Venn diagrams for parts (a)-(g) below, the shaded area represents the indicated set.

M O

T

M O

T

M O

T (1) R = T c^ (2) M ∪ O (3) M ∩ O

M O

T

M O

T

M O

T (4) R ∪ M (4) R ∩ M (6) T c^ − M

Quiz 1.

(1) A 1 = {vvv, vv d , v d v, v dd }

(2) B 1 = { d vv,^ d v d ,^ dd v,^ ddd }

(3) A 2 = {vvv, vv d , d vv, d v d }

(4) B 2 = {v d v, v dd , dd v, ddd }

(5) A 3 = {vvv, ddd }

(6) B 3 = {v d v, d v d }

(7) A 4 = {vvv, vv d , v d v, d vv, v dd , d v d , dd v}

(8) B 4 = { ddd , dd v, d v d , v dd }

Recall that A (^) i and Bi are collectively exhaustive if A (^) i ∪ Bi = S. Also, A (^) i and Bi are mutually exclusive if A (^) i ∩ Bi = φ. Since we have written down each pair A (^) i and Bi above, we can simply check for these properties. The pair A 1 and B 1 are mutually exclusive and collectively exhaustive. The pair A 2 and B 2 are mutually exclusive and collectively exhaustive. The pair A 3 and B 3 are mutually exclusive but not collectively exhaustive. The pair A 4 and B 4 are not mutually exclusive since d v d belongs to A 4 and B 4. However, A 4 and B 4 are collectively exhaustive.

(1) P [ DL ] = 0. 25

(2) P [ D ∪ L ] = P [ V L ] + P [ DL ] + P [ D B ] = 0. 35 + 0. 25 + 0. 05 = 0 .65.

(3) P [ V B ] = 0. 35

(4) P [ V ∪ L ] = P [ V ] + P [ L ] − P [ V L ] = 0. 7 + 0. 6 − 0. 35 = 0. 95

(5) P [ V ∪ D ] = P [ S ] = 1

(6) P [ L B ] = P [ L L c ] = 0

Quiz 1.

(1) The probability of exactly two voice calls is P [ N (^) V = 2] = P [{vv d , v d v, d vv}] = 0. 3 (1)

(2) The probability of at least one voice call is P [ N (^) V ≥ 1] = P [{v dd , d v d , dd v, vv d , v d v, d vv, vvv}] (2) = 6 ( 0. 1 ) + 0. 2 = 0. 8 (3) An easier way to get the same answer is to observe that P [ N (^) V ≥ 1] = 1 − P [ N (^) V < 1] = 1 − P [ N (^) V = 0] = 1 − P [{ ddd }] = 0. 8 (4)

(3) The conditional probability of two voice calls followed by a data call given that there were two voice calls is

P [{vv d } | N (^) V = 2] =

P [{vv d } , N (^) V = 2] P [ N (^) V = 2]

P [{vv d }] P [ N (^) V = 2]

(4) The conditional probability of two data calls followed by a voice call given there were two voice calls is

P [{ dd v} | N (^) V = 2] =

P [{ dd v}^ , N (^) V = 2] P [ N (^) V = 2]

The joint event of the outcome dd v and exactly two voice calls has probability zero since there is only one voice call in the outcome dd v. (5) The conditional probability of exactly two voice calls given at least one voice call is

P [ N (^) V = 2 | N v ≥ 1] =

P [ N V = 2 , N V ≥ 1]

P [ N V ≥ 1]

P [ N V = 2]

P [ N V ≥ 1]

(6) The conditional probability of at least one voice call given there were exactly two voice calls is

P [ N (^) V ≥ 1 | N (^) V = 2] =

P [ N V ≥ 1 , N V = 2]

P [ N V = 2]

P [ N V = 2]

P [ N V = 2]

Given that there were two voice calls, there must have been at least one voice call.

Quiz 1. In this experiment, there are four outcomes with probabilities P [{vv}] = ( 0. 8 )^2 = 0. 64 P [{v d }] = ( 0. 8 )( 0. 2 ) = 0. 16 P [{ d v}] = ( 0. 2 )( 0. 8 ) = 0. 16 P [{ dd }] = ( 0. 2 )^2 = 0. 04

When checking the independence of any two events A and B , it’s wise to avoid intuition and simply check whether P [ AB ] = P [ A ] P [ B ]. Using the probabilities of the outcomes, we now can test for the independence of events.

(1) First, we calculate the probability of the joint event: P [ N (^) V = 2 , N (^) V ≥ 1] = P [ N (^) V = 2] = P [{vv}] = 0. 64 (1) Next, we observe that P [ N (^) V ≥ 1] = P [{v d , d v, vv}] = 0. 96 (2) Finally, we make the comparison P [ N (^) V = 2] P [ N (^) V ≥ 1] = ( 0. 64 )( 0. 96 ) = P [ N (^) V = 2 , N (^) V ≥ 1] (3) which shows the two events are dependent.

(2) The probability of the joint event is P [ N (^) V ≥ 1 , C 1 = v] = P [{v d , vv}] = 0. 80 (4) From part (a), P [ N (^) V ≥ 1 ] = 0 .96. Further, P [ C 1 = v] = 0 .8 so that P [ N (^) V ≥ 1] P [ C 1 = v] = ( 0. 96 )( 0. 8 ) = 0. 768 = P [ N (^) V ≥ 1 , C 1 = v] (5) Hence, the events are dependent.

(3) The problem statement that the calls were independent implies that the events the second call is a voice call, { C 2 = v}, and the first call is a data call, { C 1 = d } are independent events. Just to be sure, we can do the calculations to check: P [ C 1 = d , C 2 = v] = P [{ d v}] = 0. 16 (6) Since P [ C 1 = d ] P [ C 2 = v] = ( 0. 2 )( 0. 8 ) = 0 .16, we confirm that the events are independent. Note that this shouldn’t be surprising since we used the information that the calls were independent in the problem statement to determine the probabilities of the outcomes. (4) The probability of the joint event is P [ C 2 = v, N (^) V is even] = P [{vv}] = 0. 64 (7) Also, each event has probability P [ C 2 = v] = P [{ d v, vv}] = 0. 8 , P [ N (^) V is even] = P [{ dd , vv}] = 0. 68 (8) Thus, P [ C 2 = v] P [ N (^) V is even] = ( 0. 8 )( 0. 68 ) = 0 .544. Since P [ C 2 = v, N (^) V is even]  = 0 .544, the events are dependent.

For  = 0 .01, P

[

S 0 , 100

]

= ( 1 − )^100 = ( 0. 99 )^100 = 0. 3660 (2)

P

[

S 1 , 99

]

= 100 ( 0. 01 )( 0. 99 )^99 = 0. 3700 (3)

P

[

S 2 , 98

]

= 4950 ( 0. 01 )^2 ( 0. 99 )^9 8 = 0. 1849 (4)

P

[

S 3 , 97

]

= 161 , 700 ( 0. 01 )^3 ( 0. 99 )^97 = 0. 0610 (5)

(2) The probability a packet is decoded correctly is just

P [ C ] = P

[

S 0 , 100

]

+ P

[

S 1 , 99

]

+ P

[

S 2 , 98

]

+ P

[

S 3 , 97

]

Quiz 1. Since the chip works only if all n transistors work, the transistors in the chip are like devices in series. The probability that a chip works is P [ C ] = p n^. The module works if either 8 chips work or 9 chips work. Let C (^) k denote the event that exactly k chips work. Since transistor failures are independent of each other, chip failures are also independent. Thus each P [ C (^) k ] has the binomial probability

P [ C 8 ] =

( P [ C ])^8 ( 1 − P [ C ])^9 −^8 = 9 p^8 n ( 1 − p n^ ), (1)

P [ C 9 ] = ( P [ C ])^9 = p^9 n. (2)

The probability a memory module works is

P [ M ] = P [ C 8 ] + P [ C 9 ] = p^8 n ( 9 − 8 p n^ ) (3)

Quiz 1.

R=rand(1,100); X=(R<= 0.4) ...

  • (2(R>0.4).(R<=0.9)) ...
  • (3*(R>0.9)); Y=hist(X,1:3)

For a M ATLAB simulation, we first gen- erate a vector R of 100 random numbers. Second, we generate vector X as a func- tion of R to represent the 3 possible out- comes of a flip. That is, X(i)=1 if flip i was heads, X(i)=2 if flip i was tails, and X(i)=3) is flip i landed on the edge. To see how this works, we note there are three cases:

  • If R(i) <= 0.4, then X(i)=1.
  • If 0.4 < R(i) and R(i)<=0.9, then X(i)=2.
  • If 0.9 < R(i), then X(i)=3.

These three cases will have probabilities 0.4, 0.5 and 0.1. Lastly, we use the hist function to count how many occurences of each possible value of X(i).

Quiz Solutions – Chapter 2

Quiz 2. The sample space, probabilities and corresponding grades for the experiment are

Outcome P [·] G B B 0. 36 3. 0 BC 0. 24 2. 5 C B 0. 24 2. 5 CC 0. 16 2

Quiz 2.

(1) To find c , we recall that the PMF must sum to 1. That is,

∑^3

n = 1

PN ( n ) = c

This implies c = 6 /11. Now that we have found c , the remaining parts are straight- forward.

(2) P [ N = 1 ] = PN ( 1 ) = c = 6 / 11

(3) P [ N ≥ 2 ] = PN ( 2 ) + PN ( 3 ) = c / 2 + c / 3 = 5 / 11

(4) P [ N > 3 ] =

n = 4 PN^ ( n )^ =^0

Quiz 2. Decoding each transmitted bit is an independent trial where we call a bit error a “suc- cess.” Each bit is in error, that is, the trial is a success, with probability p. Now we can interpret each experiment in the generic context of independent trials.

(1) The random variable X is the number of trials up to and including the first success. Similar to Example 2.11, X has the geometric PMF

PX ( x ) =

p ( 1 − p ) x −^1 x = 1 , 2 ,... 0 otherwise (1)

(2) If p = 0 .1, then the probability exactly 10 bits are sent is

P [ X = 10] = PX ( 10 ) = ( 0. 1 )( 0. 9 )^9 = 0. 0387 (2)

(2) P [ Y ≤ 1 ] = FY ( 1 ) = 0. 6

(3) P [ Y > 2 ] = 1 − P [ Y ≤ 2 ] = 1 − FY ( 2 ) = 1 − 0. 8 = 0. 2

(4) P [ Y ≥ 2 ] = 1 − P [ Y < 2 ] = 1 − FY ( 2 −) = 1 − 0. 6 = 0. 4

(5) P [ Y = 1 ] = P [ Y ≤ 1 ] − P [ Y < 1 ] = FY ( 1 +) − FY ( 1 −) = 0. 6

(6) P [ Y = 3 ] = P [ Y ≤ 3 ] − P [ Y < 3 ] = FY ( 3 +) − FY ( 3 −) = 0. 8 − 0. 8 = 0

Quiz 2.

(1) With probability 0.7, a call is a voice call and C = 25. Otherwise, with probability 0 .3, we have a data call and C = 40. This corresponds to the PMF

PC ( c ) =

  1. 7 c = 25
  2. 3 c = 40 0 otherwise

(2) The expected value of C is E [ C ] = 25 ( 0. 7 ) + 40 ( 0. 3 ) = 29 .5 cents (2)

Quiz 2.

(1) As a function of N , the cost T is T = 25 N + 40 ( 3 − N ) = 120 − 15 N (1)

(2) To find the PMF of T , we can draw the following tree:







  1. 1  N^ =^0

  

  1. (^3)  N = 3



  1. (^3)  N = 1 
  2. 3 N = 2

• T = 120

• T = 105

• T = 90

• T = 75

From the tree, we can write down the PMF of T :

PT ( t ) =

  1. 3 t = 75 , 90 , 105
  2. 1 t = 120 0 otherwise

From the PMF PT ( t ), the expected value of T is E [ T ] = 75 PT ( 75 ) + 90 PT ( 90 ) + 105 PT ( 105 ) + 120 PT ( 120 ) (3) = ( 75 + 90 + 105 )( 0. 3 ) + 120 ( 0. 1 ) = 62 (4)

Quiz 2.

(1) Using Definition 2.14, the expected number of applications is

E [ A ] =

∑^4

a = 1

a P (^) A ( a ) = 1 ( 0. 4 ) + 2 ( 0. 3 ) + 3 ( 0. 2 ) + 4 ( 0. 1 ) = 2 (1)

(2) The number of memory chips is M = g ( A ) where

g ( A ) =

4 A = 1 , 2

6 A = 3

8 A = 4

(3) By Theorem 2.10, the expected number of memory chips is

E [ M ] =

∑^4

a = 1

g ( A ) P (^) A ( a ) = 4 ( 0. 4 ) + 4 ( 0. 3 ) + 6 ( 0. 2 ) + 8 ( 0. 1 ) = 4. 8 (3)

Since E [ A ] = 2, g ( E [ A ]) = g ( 2 ) = 4. However, E [ M ] = 4. 8 = g ( E [ A ]). The two quantities are different because g ( A ) is not of the form α A + β.

Quiz 2. The PMF PN ( n ) allows to calculate each of the desired quantities.

(1) The expected value of N is

E [ N ] =

∑^2

n = 0

n PN ( n ) = 0 ( 0. 1 ) + 1 ( 0. 4 ) + 2 ( 0. 5 ) = 1. 4 (1)

(2) The second moment of N is

E

[

N^2

]

∑^2

n = 0

n^2 PN ( n ) = 0 2 ( 0. 1 ) + 1 2 ( 0. 4 ) + 2 2 ( 0. 5 ) = 2. 4 (2)

(3) The variance of N is

Var[ N ] = E

[

N^2

]

− ( E [ N ])^2 = 2. 4 − ( 1. 4 )^2 = 0. 44 (3)

(4) The standard deviation is σ N =

Var[ N ] =

(^00 50 )

2

4

6

8

10

(^00 500 )

2

4

6

8

10

(a) samplemean(100) (b) samplemean(1000)

Figure 1: Two examples of the output of samplemean(k)

(6) To find the conditional variance, we first find the conditional second moment

E

[

N^2 | N ≤ 10

]

n

n^2 PN | N ≤ 10 ( n ) (13)

∑^5

n = 1

n^2 ( 0. 19375 ) +

∑^10

n = 6

n^2 ( 0. 00625 ) (14)

= 55 ( 0. 19375 ) + 330 ( 0. 00625 ) = 12. 71875 (15)

The conditional variance is

Var[ N | N ≤ 10 ] = E

[

N^2 | N ≤ 10

]

− ( E [ N | N ≤ 10])^2 (16)

= 12. 71875 − ( 3. 15625 )^2 = 2. 75684 (17)

Quiz 2. The function samplemean(k) generates and plots five m (^) n sequences for n = 1 , 2 ,... , k. The i th column M(:,i) of M holds a sequence m 1 , m 2 ,... , m (^) k.

function M=samplemean(k); K=(1:k)’; M=zeros(k,5); for i=1:5, X=duniformrv(0,10,k); M(:,i)=cumsum(X)./K; end; plot(K,M);

Examples of the function calls (a) samplemean(100) and (b) samplemean(1000) are shown in Figure 1. Each time samplemean(k) is called produces a random output. What is observed in these figures is that for small n , m (^) n is fairly random but as n gets

large, m (^) n gets close to E [ X ] = 5. Although each sequence m 1 , m 2 ,... that we generate is random, the sequences always converges to E [ X ]. This random convergence is analyzed in Chapter 7.

(2) To find the CDF F (^) X ( x ), we first note X is a nonnegative random variable so that F (^) X ( x ) = 0 for all x < 0. For x ≥ 0,

F (^) X ( x ) =

∫ (^) x

0

f (^) X ( y ) dy =

∫ (^) x

0

y 4

e − y /^2 dy (5)

y 2

e − y /^2

x 0

∫ (^) x

0

e − y /^2 dy (6)

= 1 −

x 2

e − x /^2 − e − x /^2 (7)

The complete expression for the CDF is

(^00 5 10 )

1

x

FX

(x) F (^) X ( x ) =

( (^) x 2 +^1

e − x /^2 x ≥ 0 0 otherwise (8)

(3) From the CDF F (^) X ( x ),

P [0 ≤ X ≤ 4] = F (^) X ( 4 ) − F (^) X ( 0 ) = 1 − 3 e −^2. (9)

(4) Similarly, P [− 2 ≤ X ≤ 2] = F (^) X ( 2 ) − F (^) X (− 2 ) = 1 − 3 e −^1. (10)

Quiz 3. The PDF of Y is

(^0) −2 0 2

1

2

3

y

f(y)Y f (^) Y ( y ) =

3 y^2 / 2 − 1 ≤ y ≤ 1 , 0 otherwise. (1)

(1) The expected value of Y is

E [ Y ] =

−∞

y f (^) Y ( y ) dy =

− 1

( 3 / 2 ) y^3 dy = ( 3 / 8 ) y^4

1 − 1

Note that the above calculation wasn’t really necessary because E [ Y ] = 0 whenever the PDF f (^) Y ( y ) is an even function (i.e., f (^) Y ( y ) = f (^) Y (− y )).

(2) The second moment of Y is

E

[

Y^2

]

−∞

y^2 f (^) Y ( y ) dy =

− 1

( 3 / 2 ) y^4 dy = ( 3 / 10 ) y^5

1 − 1

(3) The variance of Y is

Var[ Y ] = E

[

Y^2

]

− ( E [ Y ])^2 = 3 / 5. (4)

(4) The standard deviation of Y is σ Y =

Var[ Y ] =

Quiz 3.

(1) When X is an exponential (λ) random variable, E [ X ] = 1 /λ and Var[ X ] = 1 /λ^2. Since E [ X ] = 3 and Var[ X ] = 9, we must have λ = 1 /3. The PDF of X is

f (^) X ( x ) =

( 1 / 3 ) e − x /^3 x ≥ 0 , 0 otherwise. (1)

(2) We know X is a uniform ( a , b ) random variable. To find a and b , we apply Theo- rem 3.6 to write

E [ X ] =

a + b 2

= 3 Var[ X ] =

( b − a )^2 12

This implies a + b = 6 , b − a = ± 6

The only valid solution with a < b is

a = 3 − 3

3 , b = 3 + 3

The complete expression for the PDF of X is

f (^) X ( x ) =

3 ≤ x < 3 + 3

0 otherwise.

Quiz 3. Each of the requested probabilities can be calculated using ( z ) function and Table 3. or Q ( z ) and Table 3.2. We start with the sketches.

(1) The PDFs of X and Y are shown below. The fact that Y has twice the standard deviation of X is reflected in the greater spread of f (^) Y ( y ). However, it is important to remember that as the standard deviation increases, the peak value of the Gaussian PDF goes down.

(^0) −5 0 5

x y

f(x)X

f(y)Y ← f X(x) ← fY(y)

(1) Since X is always nonnegative, F (^) X ( x ) = 0 for x < 0. Also, F (^) X ( x ) = 1 for x ≥ 2 since its always true that x ≤ 2. Lastly, for 0 ≤ x ≤ 2,

F (^) X ( x ) =

∫ (^) x

−∞

f (^) X ( y ) dy =

∫ (^) x

0

( 1 − y / 2 ) dy = x − x^2 / 4. (1)

The complete CDF of X is

−1 0 1 2 3

0

1

x

FX

(x) F (^) X ( x ) =

0 x < 0 , x − x^2 / 4 0 ≤ x ≤ 2 , 1 x > 2.

(2) The probability that Y = 1 is

P [ Y = 1] = P [ X ≥ 1] = 1 − F (^) X ( 1 ) = 1 − 3 / 4 = 1 / 4. (3)

(3) Since X is nonnegative, Y is also nonnegative. Thus FY ( y ) = 0 for y < 0. Also, because Y ≤ 1, FY ( y ) = 1 for all y ≥ 1. Finally, for 0 < y < 1,

FY ( y ) = P [ Y ≤ y ] = P [ X ≤ y ] = F (^) X ( y ). (4)

Using the CDF F (^) X ( x ), the complete expression for the CDF of Y is

−1 0 1 2 3

0

1

y

FY

(y) FY ( y ) =

0 y < 0 , y − y^2 / 4 0 ≤ y < 1 , 1 y ≥ 1.

As expected, we see that the jump in FY ( y ) at y = 1 is exactly equal to P [ Y = 1 ].

(4) By taking the derivative of FY ( y ), we obtain the PDF f (^) Y ( y ). Note that when y < 0 or y > 1, the PDF is zero.

−1 0 1 2 3

0

1

y

f(y)Y

f (^) Y ( y ) =

1 − y / 2 + ( 1 / 4 )δ( y − 1 ) 0 ≤ y ≤ 1 0 otherwise

Quiz 3.

(1) P [ Y ≤ 6 ] =

−∞ f^ Y^ ( y )^ dy^ =^

0 (^1 /^10 )^ dy^ =^0.^6.

(2) From Definition 3.15, the conditional PDF of Y given Y ≤ 6 is

f (^) Y | Y ≤ 6 ( y ) =

{ (^) f Y ( y ) P [ Y ≤6] y^ ≤^6 , 0 otherwise,

1 / 6 0 ≤ y ≤ 6 , 0 otherwise. (1)

(3) The probability Y > 8 is

P [ Y > 8] =

8

dy = 0. 2. (2)

(4) From Definition 3.15, the conditional PDF of Y given Y > 8 is

f (^) Y | Y > 8 ( y ) =

{ (^) f Y ( y ) P [ Y >8] y^ >^8 , 0 otherwise,

1 / 2 8 < y ≤ 10 , 0 otherwise. (3)

(5) From the conditional PDF f (^) Y | Y ≤ 6 ( y ), we can calculate the conditional expectation

E [ Y | Y ≤ 6] =

−∞

y f (^) Y | Y ≤ 6 ( y ) dy =

0

y 6

dy = 3. (4)

(6) From the conditional PDF f (^) Y | Y > 8 ( y ), we can calculate the conditional expectation

E [ Y | Y > 8] =

−∞

y f (^) Y | Y > 8 ( y ) dy =

8

y 2

dy = 9. (5)

Quiz 3. A natural way to produce random variables with PDF f (^) T | T > 2 ( t ) is to generate samples of T with PDF f (^) T ( t ) and then to discard those samples which fail to satisfy the condition T > 2. Here is a M ATLAB function that uses this method:

function t=t2rv(m) i=0;lambda=1/3; t=zeros(m,1); while (i<m), x=exponentialrv(lambda,1); if (x>2) t(i+1)=x; i=i+1; end end

A second method exploits the fact that if T is an exponential (λ) random variable, then T ′^ = T + 2 has PDF f (^) T ′^ ( t ) = f (^) T | T > 2 ( t ). In this case the command

t=2.0+exponentialrv(1/3,m)

generates the vector t.