ex5m2_8.doc

advertisement
Random Signals for Engineers using MATLAB and Mathcad
Copyright  1999 Springer Verlag NY
Example 2.8 Numerical Conditioning
Numerical conditioning is illustrated by a target practice example.
PROBLEM: A dart board has two circles an inner red circle at a radius of 5 in. and an outer blue
circle of radius 8 in. The probability density of a dart landing at a radius, r, on the dartboard is
given by an exponential density function
syms r
f=1 /5*exp(-r/5);
pretty(f)
1/5 exp(- 1/5 r)
SOLUTION: Given that a dart is thrown at the board we may compute the probability that the
dart will be inside a circle of radius r by the distribution function
F=1-exp(-r/5);
pretty(F)
1 - exp(- 1/5 r)
and the probability that a dart will be outside the circle of radius r is
FO=1-F;
We may also compute the conditioned probabilities. Given we know that the dart has landed
inside the circle with the 8 in. radius what is the probability that it will be in the red circle also.
We may compute this by using Equation 2.6-10.
F[r | R < 8] =
r=8; F8=subs(F);
r=0:0.1:14;
u=subs(F)/F8;
FC=f2_8_1(r,8,u);
plot(r,FC,r,subs(F))
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0
2
4
6
8
10
12
14
The curve compares the conditioned and nonconditioned distribution function.
The density function may also be compared for the two cases. The conditioned density function
can be found by Equation 2.6-10 to be
r=0:0.1:14;
u=subs(f)/F8;
fc=f2_8_2(r,8,u);
plot(r,fc,r,subs(f))
0.25
0.2
0.15
0.1
0.05
0
0
2
4
6
8
10
12
14
In both cases we have used the step function to apply the conditions expressed on the right-hand
side of Equations 2.6-14 and 2.6-15.
The functions used are given below.
function y=f2_8_1(t,r,u)
% f2_4_1 is the exponential distribution function
% where r = start and u = coefficient vector
% t = time vector
y=zeros(1,length(t));
y = u.*(stepfun(t,0)-stepfun(t,r))+stepfun(t,r);
function y=f2_8_2(t,r,u)
% f2_4_1 is the exponential density function
% where r = start and u = coefficient vector
% t = time vector
y=zeros(1,length(t));
y = u.*(stepfun(t,0)-stepfun(t,r));

Download