ex5m7_1.doc

advertisement

Random Signals for Engineers using MATLAB and Mathcad

Copyright  1999 Springer Verlag NY

Example 7.1 Matched Filtering of Colored Noise

In the example we will derive of the optimal receiver of colored noise. Let us assume that the input signal is a triangular shaped pulse centered at t= 0. The additive noise is first order correlated. The transform of the pulse is first derived and then the power spectrum for the noise is given. The input function can be plotted tau=1; a=1; t=-1.2:.01:1.2; x=a/tau*(tau+t).*(stepfun(t,-tau)-stepfun(t,0))+a/tau*(taut).*(stepfun(t,0)-stepfun(t,tau)); plot(t,x)

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

-1.5

-1 -0.5

0 0.5

1 1.5

The Fourier transform can be obtain by direct evaluation of the integrals syms x t om tau a fT=int((tau+t)/tau*exp(-i*om*t),t,-tau,0)+int((tau-t)/tau*exp(i*om*t),t,0,tau); pretty(simplify(fT))

cos(tau om) - 1

-2 ---------------

2

om tau with the substitution of the trigonometric identity

2

 sin

  



2

1

 cos

    

2

we obtain fT= a*tau*(sin(tau*om/2)/tau/om/2)^2; pretty(fT)

2

a sin(1/2 tau om)

1/4 ------------------

2

tau om we will assume that there is colored noise added to the signal with a power spectrum

S

NN

 2

N

N

 2

The optimal matched filter is by Eq.7.2-8

H opt

2 a

 

 

C

 sin

2

2

 

2

2

N

N

2

 e

 j

   t

0

The C can be set to any value and will not change the optimal nature of the solution. The time function can be obtained by inverse transforming the above expression. The expression is made up of two terms and each can be transformed individually. The first term

 sin

2

 



2

 e

 j

   t

0 which results by multiplying by

 2 and canceling  2 in the denominator. Using the inverse Fourier transform capability of Matlab we obtain syms t0 w taugt=sym('tau>0'); t0gt=sym('t0>0'); maple('assume',taugt); maple('assume',t0gt); maple('invfourier','(sin(tau*w/2))^2*exp(-i*w*t0),w,t') ans =

-1/4*Dirac(-t+t0-tau)+1/2*Dirac(-t+t0)-1/4*Dirac(-t+t0+tau)

Since the above expression is an impulse response term, the presence of the Dirac (delta) function means that the output of convolving this impulse response function with the input results in the input function being delayed by the appropriate amount as show in the expression below with t

0

=

.

y

   

2

 x

 t

    t

2

  

The resultant y(t) can be plotted as function y=f7_1(t,a,tau)

%x function y=a/tau*(tau+t).*(stepfun(t,-tau)-stepfun(t,0))+ ...

a/tau*(tau-t).*(stepfun(t,0)-stepfun(t,tau)); t=-1.2:.01:3.2; a=1;tau=1; y=f7_1(t,a,tau) - 2* f7_1(t-tau,a,tau) + f7_1(t-2*tau,a,tau); plot(t,y)

1

-0.5

-1

-1.5

0.5

0

-2

-1.5

-1 -0.5

0 0.5

1 1.5

2 2.5

3 3.5

The other term can be similarly inverse transformed by using Matlab clear t syms t tau ifourier((sin(tau*w/2)/(tau*w/2))^2*exp(-i*w*t0),w,t) ans =

1/2*(t*Heaviside(t-t0+tau)-t*Heaviside(-t+t0-tau)-t0*Heaviside(tt0+tau)+t0*Heaviside(-t+t0-tau)+tau*Heaviside(t-t0+tau)-tau*Heaviside(t+t0-tau)-2*t*Heaviside(t-t0)+2*t*Heaviside(-t+t0)+2*t0*Heaviside(tt0)-2*t0*Heaviside(-t+t0)+t*Heaviside(t-t0-tau)-t*Heaviside(-t+t0+tau)t0*Heaviside(t-t0-tau)+t0*Heaviside(-t+t0+tau)-tau*Heaviside(t-t0tau)+tau*Heaviside(-t+t0+tau))/tau^2

This results in a function function y=f7_2(t,t0,tau)

%impulse function y=1/2*(t.*stepfun(t-t0+tau,0)-t.*stepfun(-t+t0-tau,0)...

-t0*stepfun(t-t0+tau,0)+t0*stepfun(-t+t0-tau,0)...

+tau*stepfun(t-t0+tau,0)-tau*stepfun(-t+t0-tau,0)...

-2*t.*stepfun(t-t0,0)+2*t.*stepfun(-t+t0,0)...

+2*t0*stepfun(t-t0,0)-2*t0*stepfun(-t+t0,0)...

+t.*stepfun(t-t0-tau,0)-t.*stepfun(-t+t0+tau,0)...

-t0*stepfun(t-t0-tau,0)+t0*stepfun(-t+t0+tau,0)...

-tau*stepfun(t-t0-tau,0)+tau*stepfun(-t+t0+tau,0))/tau^2;

This expression for ho(t) can be used directly in the convolution integral to obtain the output, y1(t) from the input x(t). The convolution integral is taken from t = -1 because x(t) has a nonzero value when -1 < t.

The kernel is given by function f7_3 function y=f7_3(t,u,t0,tau)

%impulse function times x x=a/tau*(tau+t).*(stepfun(t,-tau)-stepfun(t,0))...

+a/tau*(tau-t).*(stepfun(t,0)-stepfun(t,tau)); y=x.*F7_2(u-t,t0,tau)

This is a numerical integration and we ignore the error messages. t=.5:.1:1.1; for i=1:length(t)

y1(i)=quad('f7_3',-1,t(i),[],[],t(i),1,1,1); end

Another expression can be used to represent the convolution integral. In the Fourier domain multiplication of a transform by 1/

represents integration and the numerator of this term. sin2(



) is divided by

 2.

The inverse transform of sin2(



) has been shown to be y(t) from the first term. We therefore integrate the output y(t) twice to produce y3(t). First define the y function f7_4(t,

,a) and then define a function f7_5(t,

,a) the integral of y from -1 to t. Then integrate f7_5 to produce the final result y3. The plot compares y3 obtained by double integration of y(t) with the convolution of x(t) with the impulse response obtained analytically. All the integrations are numerical and we ignore the error messages. function y=f7_4(t,tau,a)

%Y function from x input y=f7_1(t,a,tau)-2*f7_1(t-tau,a,tau)+ f7_1(t-2*tau,a,tau); function y=f7_5(t,tau,a)

%Y function from x input n=length(t); for i=1:n

y(i)=quad('f7_4',-1,t(i),[],[],a,tau); end for i=1:length(t)

y3(i)=quad('f7_5',-1,t(i),[],[],1,1); end

The two expressions can be compared directly by plotting y3(t) and y1(t) plot(t,y1,t,y3)

0.7

0.65

0.6

0.55

0.5

0.45

0.5

0.6

0.7

0.8

0.9

1 1.1

1.2

1.3

Examination of the figure shows that the maximum is reached when t0 =

as was the case with the rectangular waveform where the length of integration was the entire length of the input waveform. The complete optimal filter is shown in figure where we combine the two terms into one filter. In this figure we have chosen C to produce a unity gain multiplier for the filter.

x(t)

Delay



Delay

 gain = 2 y(t)

+

-

+ gain =

2

 integrate integrate

+ y

3

(t)

Optimal Filter Implementation

Download