Random Signals for Engineers using MATLAB and Mathcad Copyright 1999 Springer Verlag NY Example 2.7 Non Numerical Conditioning In this example we how we can determine how a part was manufactured given we have information about its lifetime. PROBLEM: Let us assume that one of two machines can be used to manufacture a part. The probability that the part will fail in time, t, depends on whether it was manufactured by machine A or B and we have P[T < t | A] = syms t FA=1-exp(-t); P[T < t | B ] = FB=1-exp(-0.2*t); Parts were manufactured and placed in a bin. We then select a part from the bin. What is the probability that this part will last less than t hours? It is known that machine B makes parts 3 times faster than machine A so that the probability that any part selected from the bin was made by machine B is 3 times greater than machine A. SOLUTION: First we need to determine P[A] and P[B]. Expressing the problem statement we have P[B] = PB = 3* PA = 3* P[A] and for each part, the probability that it was made by process A or B is unity, therefore we have PA+PB = 1 syms PA PB S= solve(PB-3*PA,PA+PB-1); [S.PA S.PB] ans = [ 1/4, 3/4] Using Equations 2.6-7 and 2.6-8 the probability that a part drawn from the bin will last less than t hours is F=1/4*FA + 3 /4*FB F = 1-1/4*exp(-t)-3/4*exp(-1/5*t) f=diff(F) f = 1/4*exp(-t)+3/20*exp(-1/5*t) hold on;ezplot(f,[0 5]) ; ezplot(F,[0 5]); axis([0 5 0 1]) 1-1/4*exp(-t)-3/4*exp(-1/5*t) 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.5 1 1.5 2 2.5 t 3 3.5 4 4.5 5 We can now determine the probability that a part drawn from the bin was made by machine A or B given that it lasted less than t hours. Using Equation 2.6-7 or P[A | T < t ] = PAT=1/4*FA/F; P[B | T < t ] = PBT=3/4*FB/F; If we plot PAT and PBT as a function to t we can determine as a function of t, which machine is more likely to have made the part figure hold on; ezplot(PAT, [0 5]); ezplot(PBT,[0 5]); axis([0 5 0 1]) (3/4-3/4*exp(-1/5*t))/(1-1/4*exp(-t)-3/4*exp(-1/5*t)) 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.5 1 1.5 2 2.5 t 3 3.5 4 4.5 5 The Curve shows that at if the part is known to have lasted less than 1.5 hours the part was equally likely to be made by machine A or B. After 1.5 hours it is more likely that it was made by machine B. Before that time it is more likely that it was made by machine A. We can re-interpret the results by examining the situation at t= 3 hours. Let us assume that there were 100 parts placed in the bin. On the average there were 25 A parts and 75 B parts. At t = 3 we can compute the number of each part type that has already failed by multiplying by the cumulative distribution function Part A Part B t=3; pa = 25*subs(FA); pb = 75* subs(FB); [pa pb pa+pb] ans = 23.7553 33.8391 57.5945 Total Failed = 57.59 When we select a part and we know it has failed before 3 hours, we are selecting parts from the total that failed or from 58 parts. 24 were made by A and 34 were made by B therefore the ratios are 24/58 ans = 0.4138 Part A 34/58 ans = 0.5862 Part B These are shown on the curve above as the probability values. For all t we know that any failed part was surely made by machine A or B. This can be shown by direct computation of PAT(t) + PBT(T) or by numerically computing the sum for all t as shown below figure ezplot(PAT+PBT, [0 5]), axis([0 5 0 2]) (1/4-1/4*exp(-t))/(1-1/4*exp(-t)- ~~~ )/(1-1/4*exp(-t)-3/4*exp(-1/5*t)) 2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0 0.5 1 1.5 2 2.5 t 3 3.5 4 4.5 5