+ All Categories
Home > Documents > Prcticas Ingeniera de Telecomunicaciones

Prcticas Ingeniera de Telecomunicaciones

Date post: 03-Feb-2022
Category:
Upload: others
View: 7 times
Download: 0 times
Share this document with a friend
16
TELECOMMUNICATIONS ENGINEERING STATISTICS 2012-2013 COMPUTER LAB SESSION # 3. PROBABILITY MODELS AIM: Introduction to most common discrete and continuous probability models. Characteri- zation, graphical representation. Solving real problems by simulation in MATLAB/Octave. In general, to generate continuous random variables it is usual to apply the inverse transform method of the distribution function (if inverse exists). For discrete r.v.’s, it is possible to gene- rate them using a boolean. In MATLAB/Octave, there exist several functions implemented in MATLAB/Octave in order to generate frequently used probability models. The next table summarizes some of the most common functions used in MATLAB/Octave to generate probability models of discrete and continuous random variables: Function Description Syntax normrnd random numbers N (μ, σ) normrnd(MU,SIGMA,m,n) randn random numbers N (0, 1) randn(m,n) exprnd random numbers Exp(λ) exprnd(1/lambda,m,n) binornd random numbers Bin(n, p) binornd(N,P,m,n) poissrnd random numbers Poiss(λ) poissrnd(lambda,m,n) where m and n, are respectively the numbers of rows and columns generated. 1. Continuous case Normal distribution Recall that Normal distribution has density function: X ∼N (μ, σ): f (x)= 1 σ 2π exp - 1 2σ 2 (x-μ) 2 , donde x R, σ> 0 y μ R. 1. Create a function in MATLAB/Octave which returns the values of the density function of a r.v. distributed as N (μ, σ). %% create the function fd_normal.m function y = fd_normal(x, mu, sigma) for i=1:length(x) y(i) = exp(-0.5*((x(i)-mu)/sigma)^2) / (sigma*sqrt(2*pi)); end %% Telecommunications Engineering - Estad´ ıstica (2012-2013), LAB 3. PROBABILITY MODELS 1
Transcript
Page 1: Prcticas Ingeniera de Telecomunicaciones

TELECOMMUNICATIONS ENGINEERING

STATISTICS

2012-2013

COMPUTER LAB SESSION # 3. PROBABILITY MODELS

AIM: Introduction to most common discrete and continuous probability models. Characteri-zation, graphical representation. Solving real problems by simulation in MATLAB/Octave.

In general, to generate continuous random variables it is usual to apply the inverse transformmethod of the distribution function (if inverse exists). For discrete r.v.’s, it is possible to gene-rate them using a boolean. In MATLAB/Octave, there exist several functions implemented inMATLAB/Octave in order to generate frequently used probability models.

The next table summarizes some of the most common functions used in MATLAB/Octave togenerate probability models of discrete and continuous random variables:

Function Description Syntax

normrnd random numbers N(µ, σ) normrnd(MU,SIGMA,m,n)

randn random numbers N(0, 1) randn(m,n)

exprnd random numbers Exp(λ) exprnd(1/lambda,m,n)

binornd random numbers Bin(n, p) binornd(N,P,m,n)

poissrnd random numbers Poiss(λ) poissrnd(lambda,m,n)

where m and n, are respectively the numbers of rows and columns generated.

1. Continuous case

Normal distribution

Recall that Normal distribution has density function:

X ∼ N (µ, σ) : f(x) =1

σ√

2πexp−

12σ2

(x−µ)2 , donde x ∈ R, σ > 0 y µ ∈ R.

1. Create a function in MATLAB/Octave which returns the values of the density function of ar.v. distributed as N (µ, σ).

%% create the function fd_normal.m

function y = fd_normal(x, mu, sigma)

for i=1:length(x)

y(i) = exp(-0.5*((x(i)-mu)/sigma)^2) / (sigma*sqrt(2*pi));

end

%%

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 1

Page 2: Prcticas Ingeniera de Telecomunicaciones

2. Use the function created in previous exercise to represent graphically the Normal r.v., fordifferent values of the parameters of the distribution:

a) Fix σ and change µ ⇒ Consider 3 Normal distributions with constant standard de-viation (σ = 1) and different means (µ =-1,0,1). Analyze the shape and the position ofthe distribution in terms of model parameters.

b) Fix µ and change σ ⇒ Consider 3 Normal distributions with constant mean (µ = 0)and different standard deviation (σ =0.3,0.5,1.2). Analyze the shape and the position ofthe distribution in terms of model parameters.

% a)

>> x = -5:0.01:5;

>> y1 = fd_normal(x,-1,1); % y1 is Normal with mean -1 and s.d. 1

>> y2 = fd_normal(x, 0,1); % y2 is Normal with mean 0 and s.d. 1

>> y3 = fd_normal(x, 1,1); % y2 is Normal with mean +1 and s.d. 1

% b)

>> y4 = fd_normal(x, 0, 0.3); % y4 is Normal with mean 0 and s.d. 0.3

>> y5 = fd_normal(x, 0, 0.5); % y5 is Normal with mean 0 and s.d. 0.5

>> y6 = fd_normal(x, 0, 1.2); % y6 is Normal with mean 0 and s.d. 1.2

Once we have the 6 normal distributed r.v.’s, we can compare them graphically using thecommands: subplot1; plot and hold on, hold off.

% GRAPHIC for CASE a)

>> subplot(1,2,1) % 1 row, 2 columns, graph no 1

>> hold on % holds the current plot so that

% subsequent graphing commands add to the existing graph

>> plot(x,y1, ‘b’) % graph x/y1 in blue

>> plot(x,y2, ‘g’) % graph x/y2 in green

>> plot(x,y3, ‘r’) % graph x/y2 in red

>> hold off % returns to the default

% GRAPHIC for CASE b)

>> subplot(1,2,2) % 1 row, 2 columns, graph no 2

>> hold on

>> plot(x,y4, ‘b’)

>> plot(x,y5, ‘g’)

>> plot(x,y6, ‘r’)

>> hold off

1subplot allow us to create several graphs in the same panel. For example, subplot(1,2,i), implies we plot inone row and two columns, graphs i = 1 and 2

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 2

Page 3: Prcticas Ingeniera de Telecomunicaciones

% You can also

>> subplot(1,2,1)

>> plot(x,y1,‘b’,x,y2,‘g’,x,y3,‘r’)

>> subplot(1,2,2)

>> plot(x,y4,‘b’,x,y5,‘g’,x,y6,‘r’)

-5 0 50

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

-3 -2 -1 0 1 2 30

0.2

0.4

0.6

0.8

1

1.2

1.4

mu = -1 , sigma = 1mu = 0 , sigma = 1mu = 1 , sigma = 1

mu = 0 ,sigma = 0.3mu = 0 , sigma = 0.5mu = 0 ,sigma = 1.2

Note: Another alternative way to represent the graph for a Normal distribution (µ = 0 y σ = 2,5)for x ∈ (−10, 10) may be:

>> fplot(‘fd_normal(x, 0, 2.5)’, [-10 10], ‘g’)

MATLAB’s command disttool in the Command Window, we can plot the density functionsfor more probability models selection Function Type/PDF.

3. Generate in MATLAB/Octave random numbers from a Normal distribution.

In MATLAB/Octave’s it is possible to generate random numbers from a Normal dis-tribution (µ, σ), using build-in functions as:

>> x= normrnd(MU,SIGMA,m,n);

Command randn, generates random number from a standard Normal distribution (i.e., withmean µ = 0 and standard deviation σ = 1). From randn, it is also possible to generate randomnumbers ∼ N (µ, σ). Let Z ∼ N (0, 1), we can obtain X ∼ N (µ, σ), given that:

X = Z · σ + µ

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 3

Page 4: Prcticas Ingeniera de Telecomunicaciones

>> z= randn(m,n);

>> x= z*sigma + mu;

We can check that the generated numbers are normally distributed by N (µ, σ) by itshistogram:

>> m=1000; n=1;

>> sigma=0.75; mu=1;

>> z=randn(m,n); x=z*sigma + mu;

>> hist(x)

-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.50

50

100

150

200

250

300

4. Cumulative distribution function (CDF). In MATLAB/Octave, command normcdf(x,mu,sigma)

gives the probability p = P (X ≤ x) of a Normal distribution of parameters µ and σ. Repre-sent the cumulative distribution function for values of x ∈ [−3, 3], given that X is standardnormal.

>> x = [-3:0.01:3];

>> mu=0; sigma=1;

>> p = normcdf(x,mu,sigma); % p = normcdf(x) gives

% the CDF of a

% N(0,1)

% Its inverse is x = norminv(p,mu,sigma)

>> plot(x,p)

>> grid on

-3 -2 -1 0 1 2 30

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 4

Page 5: Prcticas Ingeniera de Telecomunicaciones

2. Discrete case

Binomial distribution

The probability function p(x) of a Binomial distribution Bin(n, p) is:

X ∼ Bin(n, p) : p(x) =

(n

x

)px(1− p)n−x where x = 0, 1, ..., n y 0 ≤ p < 1.

where n is the number of trials and the parameter p the probabolity of success.

1. Create a MATLAB/Octave’s function to represent graphically the probability function of aBinomial distribution.

%% create fp_binomial.m

function y=fp_binomial(x,n,p)

for i=1:length(x)

y(i)=(nchoosek(n,x(i)))*(p^x(i))*((1-p)^(n-x(i))) ;

end

%%

Note: function nchoosek(n,x) computes(nx

), however, for large values of n, the result is

not exact. Therefore, for large values of n, we can use Gamma function, Γ:

Γ(p) =

∫ +∞

0e−xxp−1dx, where p > 0

Properties of Gamma function (Γ):

a) Γ(1) = 0! = 1

b) Γ(p) = (p− 1)Γ(p− 1), ∀p > 0 and therefore Γ(p) = (p− 1)!, ∀p ∈ N.

c)(nx

)= Γ(n+1)

Γ(x+1)·Γ(n−x+1)

d) Γ(12) =

√π.

2. Create in MATLAB/Octave a function to represent probability functions from a Binomialdistribution for large values of n.

%% crete fp_binomialN.m

%% using Prop. 3 of Gamma function

function y = fp_binomialN(x,n,p)

for i=1:length(x)

y(i)=(gamma(n+1)*(p^x(i))*((1-p)^(n-x(i))))/

(gamma(x(i)+1)*gamma(n-x(i)+1));

end

%%

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 5

Page 6: Prcticas Ingeniera de Telecomunicaciones

3. Use the function created in the previous section, and represent graphically the probabilityfunction of a Binomial r.v. for:

a) Fix p and change n ⇒ create 3 Binomials:

Bin(5,0.2), Bin(10,0.2), Bin(20,0.2)

b) Fix n and change p ⇒ create 3 Binomials:

Bin(100,0.1), Bin(100,0.5), Bin(100,0.8)

% Case a):

>> x5=0:5 % create a sequence between 0 and 5

>> y5=fp_binomial(x5,5,0.2) % call to fp_binomial.m

>> sum(y5) % check if sum is =1

>> x10=0:10;

>> y10=fp_binomial(x10,10,0.2);

>> x20=0:20;

>> y20=fp_binomial(x20,20,0.2);

% Caso b):

>> x100 = 0:100;

>> y1 = fp_binomialN(x100, 100, 0.1); % call to

>> y2 = fp_binomialN(x100, 100, 0.5); % fp_binomialN.m

>> y3 = fp_binomialN(x100, 100, 0.8);

We can compare both graphs:

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 6

Page 7: Prcticas Ingeniera de Telecomunicaciones

>> subplot(1,2,1)

>> plot(x5,y5,‘.’, x10,y10, ‘+’, x20, y20, ‘*’);

>> legend(‘n=5, p=0.2’, ‘n=10, p=0.2’, ‘n=20, p=0.2’)

>> subplot(1,2,2)

>> plot(x100, y1, ‘.’, x100, y2, ‘+’, x100, y3, ‘*’);

>> legend(‘n = 100, p = 0.1’, ‘n = 100, p = 0.5’, ‘n = 100, p = 0.8’);

0 5 10 15 200

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

n=5, p=0.2n=10, p=0.2n=20, p=0.2

0 20 40 60 80 1000

0.02

0.04

0.06

0.08

0.1

0.12

0.14

n = 100 , p = 0.1n = 100 , p = 0.5n = 100 , p = 0.8

4. By definition, we know tha Bin(n, p) is the sum of n independent Bernoulli r.v.’s:

Binom(n, p) = Bern(p) + ...+ Bern(p)︸ ︷︷ ︸n times

Create a function in MATLAB/Octave to generate random numbers from the Binomial dis-tribution.

%% create function na_binomial.m

function y= na_binomial(n_dat, n, p) % ‘n_dat’ is

% no of binomial data

% to obtain

prob = rand(n,n_dat); % simulate ‘n’ trials

success = prob < p; % if it holds, then we obtain a success

y =sum(success); % sum all success

%%

In Command Window:

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 7

Page 8: Prcticas Ingeniera de Telecomunicaciones

% Obtain 10 binomial numbers from the sum of the no

% of successes from n trials with probability of success p

>> y = na_binomial(10,n,p)

Numerically, we can verified the properties of the mean and variance of the simulatedBinomial:

E[X] = n× pVar[X] = n× p× q

>> n=100; p=0.1;

>> y = na_binomial(10,n,p)

>> mean(y) % aprox. 10

>> var(y) % aprox. 9

2.1. Generation of random variables

As noted in previous practical, the inverse transform method allow us to generate continuousrandom variables from its distribution function if it admits inverse.

Weibull distribution: Let X be a Weibull2 random variable, such that X ∼Weibull(α, β),with distribution function:

FX(x) =

{0 x > 0

1− e−(x/β)α 0 ≤ x

where α and β are known parameters. Give MATLAB/Octave’s code to generate Weibulldistributed r.v’s.

X From inverse transform method, considering u = FX(x),

1− e(x/β)α = u

e(x/β)α = 1− u(x/β)α = − ln(1− u)

x/β = [− ln(1− u)]1α

x = β[− ln(1− u)]1α

2NOTA: this distribution is very common in reliability, for instance, to study the lifetimes of components untillit fails.

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 8

Page 9: Prcticas Ingeniera de Telecomunicaciones

And therefore:

>> u = rand(n,1);

>> x = beta*(-log(1-u))^(1/alpha);

3. Q function

The Q function is defined as the complement of the distribution function of a standard normalN (0, 1), i.e. as:

Q(x) = P (X > x) with X ∼ N (0, 1)

Suppose a Q function with upper bounds (cs1) and (cs2) and lower bound (ci) given by

Q(x) ≤ 1

2e−

x2

2 ∀ x ≥ 0 (cs1)

Q(x) <1√2πx

e−x2

2 ∀ x > 0 (cs2)

Q(x) >1√2πx

(1− 1

x2

)e−

x2

2 para todo x > 1 (ci)

a) MATLAB/Octave’s function normcdf(x,MU,SIGMA) returns the CDF of a N (µ, σ). Howwould you compute in MATLAB/Octave Q function?

>> Q = 1 - normcdf(x,0,1)

b) Write a MATLAB/Octave’s code to represent graphically the Q function in the interval (0, 5]with upper bounds cs1 and cs2 and lower bounds ci. The obtained result must be similarto figure 1.

Note:

Represent x ∈ (0, 5] as x=[0.01:0.01:5].

For the lower bound ci, observe that there is a vertical asymptote in x = 1, therefore,define xi=[1.01:0.01:5] only for this bound.

Use logarithmic scale to represent the bounds.

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 9

Page 10: Prcticas Ingeniera de Telecomunicaciones

>>x1= [1.01:0.01:5];

>>for i=1:length(x1)

ci(i) = (1/x1(i)*sqrt(2*pi))*(1- (1/x1(i)^2))*exp(-0.5*x1(i)^2);

end

>>x = [0.01:0.01:5];

>>for i=1:length(x)

cs1(i)=0.5*exp(-0.5*x(i)^2);

cs2(i)=(1/(x(i)*sqrt(2*pi))) * exp(-0.5*x(i)^2);

end

>>q = 1- normcdf(x,0,1);

>> plot(x, log(q), ‘black’)

>> hold on

>> plot(x, log(cs1), ‘r’)

>> plot(x, log(cs2), ‘g’)

>> plot(x1, log(ci), ‘m’)

>> hold off

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5-20

-15

-10

-5

0

5

10log(q)log(cs1)log(cs2)log(ci)

Figura 1: Graphical representation of Q function with bounds in log scale, log(cs1), log(cs2)and log(ci). Vertical line represent the asymptte in x = 1.

4. Exercises of interest

1. Given Y distributed as Cauchy , which can be obtained as Y = tg (X) with X as U(−π

2 ,π2

),

how would you use this information to generate a Cauchy?

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 10

Page 11: Prcticas Ingeniera de Telecomunicaciones

If it is knows that there is no need to apply the inverse transform method, we cansimply:

>> x=unifrnd(-pi/2,pi/2, 100,1); % generate uniforms in the interval

% (-pi/2,pi/2)

>> y=tan(x); % apply tangent

2. Let be X ∼ N (0, σ = 3). If a circle with radius |x| of the defined random variable. Computein terms of the Q function the probability that the generated circle has a greater or equalarea to π. Evaluate the probability with MATLAB/Octave analitically and by simulation.

Let C be a r.v. “area of the circle”, we have to compute

P (C ≥ π) = P(πX2 ≥ π

)= P

(X2 ≥ 1

)= P (X ≥ 1) + P (X ≤ −1)

= P

(X − 0

3≥ 1− 0

3

)+ P

(X − 0

3≤ −1− 0

3

)= 2Q

(1

3

)to evaluate the result in MATLAB/Octave:

>> x=2*(1-normcdf(1/3))

0.7389

by simulation:

>> x=normrnd(0,3,1000,1);

>> area=pi*x.>2;

>> c=(area>=pi);

>> prob=sum(c)/1000

0.7080

3. Let X be a r.v. “hours dedicated to perform an activity”, with density function

f (x) =

{14 (x+ 1) 0 < x < 2

0 otherwise

a) Calculate, analitically and using MATLAB/Octave, the probability that the time requi-red to perform the activity is more than one hour and a half.

b) If 10 activities are performed following a r.v.X, calculate analitically and using MATLAB/Octave,the probability of exactly in three of the activities, the time employed to perform eachof them is more than one hour and a half.

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 11

Page 12: Prcticas Ingeniera de Telecomunicaciones

a) Analitically we have:

P (X > 1,5) =

∫ +∞

x=1,5f (x) dx =

∫ 2

x=1,5

1

4(x+ 1) dx =

1

4

1

2

[x2]21,5

+1

4[x]21,5

=1

8

(4− 9

4

)+

1

4

(2− 3

2

)=

7

32+

1

8=

11

32= 0,3438

To solve using MATLAB/Octave, we use the inverse transform method, so we calculatethe distribution function:

F (x) =

0 x < 0∫ x

014 (y + 1) dy = 1

8x2 + 1

4x 0 ≤ x < 21 2 ≤ x

and the inverse:1

8x2 +

1

4x = u

x2 + 2x− 8u = 0

x =−2±

√4 + 32u

2

From the definition of the r.v. X we only consider the positive value, and therefore togenerate the random variable:

u ∼ U (0, 1)

x =−2 +

√4 + 32u

2

The MATLAB/Octave’s code is:

>> u=rand(1000,1);

>> x=(-2+sqrt(4+32*u))/2;

>> prob=sum(x>1.5)/1000

0.33800

b) Analitically, if the random variable Y is defined as “number of activities amongthe 10 in which the employed time is more than one hour and a half”, we have Y ∼Bin

(n = 10, p = 11

32

)and calculate

P (Y = 3) =

(10

3

)(11

32

)3(21

32

)7

= 0, 2555

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 12

Page 13: Prcticas Ingeniera de Telecomunicaciones

The MATLAB/Octave’s code is:

>> u=rand(1000,10);

>> x=(-2+sqrt(4+32*u))/2;

>> conta=(x>1.5);

>> suma=sum(conta,2);

>> prob=sum(suma==3)/1000

0.24500

4. Ex. FEB 2004 Ing. Tel. (C1a) (link). The aim of this problem is to analyze a communicationchannel . When the channel canal transmits a 1, the receptor recieves a r.v. which follow aNormal distribution with mean 1 and variance 0, 5. If the binary channel transmits a 2, thereceptor recieves a Normal r.v. with mean 2 and variance 0, 5. Let P (1) be the probability iftransmiting a 1.

a) Given P (1) = 0, 75. What is the probability that a 1 has been transmited if the receptorhas received a signal greater than 2?

T1 = “transmit 1”, P (T1) = 0,75 , R|T1 ∼ N(1, 0,5)T2 = “transmit 2”, P (T2) = 0,25 , R|T2 ∼ N(2, 0,5)

P (T1|R > 2) =P (R > 2|T1)P (T1)

P (R > 2)=

=P (R > 2|T1)P (T1)

P (R > 2|T1)P (T1) + P (R > 2|T2)P (T2)

Let Z1 = R|T1−1√0,5

and Z2 = R|T2−2√0,5

,

P (T1|R > 2) =P (Z1 > 1,41)× 0,75

P (Z1 > 1,41)× 0,75 + P (Z2 > 0)× 0,25

=0,0793× 0,75

0,0793× 0,75 + 0,5× 0,25= 0,3224

In MATLAB/Octave, it is possible to approximate the probability by:

>> n=10000;

>> u=rand(n,1); % simulate n random trials

>> p=0.75; % is the probability to transmit a 1

% message transmition in the channel

>> t=1*(u<=p)+2*(u>p);

% message reception

>> r=(t==1).*normrnd(1,sqrt(0.5),n,1)+(t==2).*normrnd(2,sqrt(0.5),n,1);

>> r=2*(r>2)+1*(r<=2);

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 13

Page 14: Prcticas Ingeniera de Telecomunicaciones

% create a crosstable with transmited/received

>> a=crosstab(t,r)

>> a =

6894 599 % a(1,1) a(1,2)

1258 1249 % a(2,1) a(2,2)

% to calculate the probability P(t==1|r>2), we calculate

>> a(1,2)/(a(1,2)+a(2,2))

0.3241

5. Ex. SEP 2007 Ing. Tec. Tel. (P2b). (link). The duration in days of a type of sensors follows aWeibull distribution with:

F (t) = 1− exp

(−(t

α

)1/2)

f (t) =1/2

α1/2t−1/2 exp

(−(t

α

)1/2)

con α > 0.

a) Suppose a box with 60 unused sensors with duration time distributed as a Weibull withα = 1

4 days, which verifies that E [T ] = 12 days and V [T ] = 5

4 days2. Suppose you startusing a sensor from the box and replace it with another one from the box whenever itfails. What is the probability that when the last sensor of the box has failed it has beenpassed 47 days? Use any of this values.

x 1,64 −1,64 1,96 −1,96 47 −47

Q (x) 0,05 0,95 0,025 0,975 ' 0 ' 1

b) Comment next MATLAB’s code, what it the approximate value of prob.

>> u=rand(60,1000);

>> w=0.25*(-log(1-u)).^(1/0.5);

>> s=sum(w);

>> prob=sum(s<47)/1000

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 14

Page 15: Prcticas Ingeniera de Telecomunicaciones

a) Let Ti a r.v. of time until ith sensor fails, calculate:

P

(60∑i=1

Ti ≤ 47

)

Given that the r.v.’s Ti verify Central Limit Theorem conditions, we have

60∑i=1

Ti ∼ N

(60

1

2,

√60

5

4

)

if we standardize

P

(60∑i=1

Ti ≤ 47

)= P

∑60i=1 Ti − 601

2√605

4

<47− 601

2√605

4

P

(Z <

47− 30

8, 66

)= P (Z < 1, 96) = 1−Q (1, 96) = 1− 0, 025 = 0, 9750

b) Firstly, we have to generate a Weibull distribution. We can apply inverse transformmethod. Therefore

F (t) = 1− exp

(−(t

α

)β)= u

ln (1− u) = −(t

α

)βt = α [−Ln (1− u)]1/β

First line generates a 60× 1000 matrix with random numbers U (0, 1). In second line,we generate a 60× 1000 matrix, with random number distributed as a Weibull withα = 1

4 days, (we are generating times when sensors are failing). Third line, applies thetotal sum of the 60 sensors. Finally, fourth line checks how many times out of 1000, thetotal duration is less than 47, by using he boolean condition (s < 47).

Therefore, this code has the same answer as in a). So the result of prob should be veryclose to the theoretical value of 0, 9750.

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 15

Page 16: Prcticas Ingeniera de Telecomunicaciones

5. Proposed exercises

NOTE: These exercises are not part of the compulsory assignment. Their resolution is recom-mended for gaining a better understanding of the concepts introduced in this Lab Session.

1. Indicate MATLAB/Octave’s code to solve the problem proposed in: Ex. SEP 2005 Ing. Tec.Tel. C3b (link).

2. Indicate MATLAB/Octave’s code to solve the problem proposed in: Ex. JUN 2002 Ing. Inf.(P1b) (link).

3. Indicate MATLAB/Octave’s code to solve the problem proposed in: Ex. SEP 2007 Ing. Tec.Tel. (C4a y C4b). (link).

Telecommunications Engineering - Estadıstica (2012-2013), LAB 3. PROBABILITY MODELS 16


Recommended