ex5m3_2.doc

advertisement
Random Signals for Engineers using MATLAB and Mathcad
Copyright  1999 Springer Verlag NY
Example 3.2 Moments of Discrete Distributions
In this example we will derive relationships for the expected values of the binomial and geometric
distributions and apply the results to the solution of problems. We first state a problem.
PROBLEM: Wood screws are that are supplied by two manufactures A and B are placed in a bin with 70%
being manufactured by A and 30% by B. They are mixed in the bin and are withdrawn randomly to fill
individual orders of 12 screws each. What is the expected number of screws from manufacturer A and B in
each order?
SOLUTION: The problem can be solved using simple reasoning. Since there are n =12 screws in each
order there a 12 p from manufacturer A and 12 q from B. The values for p are p = 0.7 and q = 0.3 which
correspond to the percentage that there are from each manufacturer in the bin. The problem can be solved
using more formal methods. The number of parts manufactured by A in each order follows a binomial
distribution with n = 12 and p = 0.7. The solution to the problem therefore requires finding E[K]. We
begin by writing the binomial distribution law
syms k n p q
kfac=sym('k!');
Bk=subs(kfac,k,n)/(subs(kfac,k,k)*subs(kfac,k,n-k))*p^k*(q)^(n-k);
P[x = k] =
pretty(Bk)
k (n - k)
n! p q
-------------k! (n - k)!
The expected value of k is therefore
Ek=simplify(symsum(k*Bk,k,0,n))
Ek =
n*p*(q+p)^(n-1)
The expansion of the sum used Matlab symbolic capability. The sum was symbolically expanded and the
result simplified. Since (p + q ) = 1 we have E[K] = n p which agrees with the results of our intuitive
discussion above.
It is instructive to show the steps in the reduction of the sum to the final result. In the expression E[K] let
us substitute m = k -1 . When k = 0, m =1 and k = n, m = n-1. We now have
syms m
Bk1=subs(kfac,k,n)/(subs(kfac,k,m)*subs(kfac,k,n-m-1))*p^(m+1)*(q)^(nm-1);
E[K] =
pretty(Bk1)
(m + 1) (n - m - 1)
n! p
q
-----------------------m! (n - m - 1)!
Factoring out n and p from the summation
Bm=n*p*subs(kfac,k,n-1)/(subs(kfac,k,m)*subs(kfac,k,n-m1))*p^(m)*(q)^(n-1-m);
pretty(Bm)
m (n - m - 1)
n p (n - 1)! p q
---------------------------m! (n - m - 1)!
Ek=simplify(symsum(Bm,m,0,n))
Ek =
n*p*(q+p)^(n-1)
The term in the bracket is (p + q)n-1 as above and we arrive at the same result for E[K] = n p.
PROBLEM: We now redo the statement of the problem. Manufacturer A produces slotted screws and B
makes Philips head screws. The order are now filled by selecting screws at random from the bin until a
Philips head screw is found and then we consider the order complete. What is the expected number of
screws in an order?
SOLUTION: The number of screws in an order follows a geometric distribution in k, with k equal to the
number of parts in each order. The desired result is just E[K] for a geometric distribution with p = 0.7.
E[K] =
symsum(k*p^k*q,k,0,inf)
ans =
q*p/(p-1)^2
Again we have used the symbolic capability of Matlab in order to sum the infinite series. We notice that q
= 1 - p and simplify the expression to obtain E[K] = p / q for the final result.

Download