Stochastic signals and processes Lec. 8 Samuel Schmidt 25 ... · Lec. 8 Samuel Schmidt 25-10-2011...

Preview:

Citation preview

Stochastic signals and processes Lec 8

Samuel Schmidt 25-10-2011

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

How to filter a signal Y(t) so it became as similar to a desired signal S(t) as possible

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

bull Noise contaminated signal

bull Estimate the linear filter L[middot] so Ŝ(t) become as close to S(t) as possible

Y(t)=S(t)+N(t)

Ŝ(t)=L[Y(t)]

Wiener filter

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

Y(t

)

Y(t)

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Y(t)S(t) and N(t) are zero mean stationary processes

bull L[middot] is a linear filter

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

How to filter a signal Y(t) so it became as similar to a desired signal S(t) as possible

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

bull Noise contaminated signal

bull Estimate the linear filter L[middot] so Ŝ(t) become as close to S(t) as possible

Y(t)=S(t)+N(t)

Ŝ(t)=L[Y(t)]

Wiener filter

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

Y(t

)

Y(t)

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Y(t)S(t) and N(t) are zero mean stationary processes

bull L[middot] is a linear filter

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

How to filter a signal Y(t) so it became as similar to a desired signal S(t) as possible

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

bull Noise contaminated signal

bull Estimate the linear filter L[middot] so Ŝ(t) become as close to S(t) as possible

Y(t)=S(t)+N(t)

Ŝ(t)=L[Y(t)]

Wiener filter

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

Y(t

)

Y(t)

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Y(t)S(t) and N(t) are zero mean stationary processes

bull L[middot] is a linear filter

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Noise contaminated signal

bull Estimate the linear filter L[middot] so Ŝ(t) become as close to S(t) as possible

Y(t)=S(t)+N(t)

Ŝ(t)=L[Y(t)]

Wiener filter

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

Y(t

)

Y(t)

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Y(t)S(t) and N(t) are zero mean stationary processes

bull L[middot] is a linear filter

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

Y(t

)

Y(t)

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Y(t)S(t) and N(t) are zero mean stationary processes

bull L[middot] is a linear filter

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Y(t)S(t) and N(t) are zero mean stationary processes

bull L[middot] is a linear filter

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Y(t)S(t) and N(t) are zero mean stationary processes

bull L[middot] is a linear filter

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull FIR filters (M-order)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Or like

119884 119899 = 120596119896119883(119899 minus 119896)

119872minus1

119896=0

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull In linear system the order of multiplication and addition is irrelevant

bull Defined by super position

][][][][ 2121 nxTbnxTanxbnxaT

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Linear algebra Two vectors is orthogonal if the dot product is zero

bull That corresponds zero correlation between two signals

0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

N(t

)N(t)

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

-2 -15 -1 -05 0 05 1 15 2-4

-3

-2

-1

0

1

2

3

4

S

N

Scatter between S(t) and N(t)

-5 -4 -3 -2 -1 0 1 2 3 4 5-4

-3

-2

-1

0

1

2

3

4Scatter between Y(t) and N(t)

N(t

)

X(t)

Orthogonal (r=00) Non-orthogonal (r=069)

S(t) vs N(t) Y(t) vs N(t)

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull If two process are orthogonal for all delays in a give range the process are also orthogonal after linear transformation

IF

Then

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Error ε(t)= Ŝ(t) - S(t)

bull Mean square error

E[|ε(t)|2]= E[| Ŝ(t) - S(t) |2]

E[|ε(t)|2]=E[| L[Y(ξ)] - S(t) |2]

E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]

0 1 2 3 4 5-5

0

5

Time (s)

Se(t

)

Se(t)

- 0 1 2 3 4 5

-5

0

5

Time (s)

S(t

)

S(t)

0 1 2 3 4 5-5

0

5

Time (s)

e(t

)

e(t)=

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull The Minimum mean-square error is obtained when the error ε(t) is Orthogonal to the unfiltered signal Y(ξ) where ξ is in the range [ti tf]

E[Y(ξ) e(t)]=E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

bull That means thats the

filter is optimal when the

Correlation between Y(t+k)

and e(t) is low for all k

-5 -4 -3 -2 -1 0 1 2 3 4 5-08

-06

-04

-02

0

02

04

06

08

1

Y(t)

e(t

)

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull The mean-square error is mean when the correlation between the e(t) and the signal is zero that is the optimal filter

0 05 1 15 2 25 3 35 4 45 5-5

-4

-3

-2

-1

0

1

2

3

4

5

Time (s)

Y(t) and e(t)

Y(t)

e(t)

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

The Minimum mean-square error can be estimated

Since E[(S(t)- Ŝ(t) ) Y(ξ) ]=0

Is E[(S(t)- L[Ŝ(t)] ) L[Y(ξ)] ]=0

Thereby is the Minimum mean-square

em=E[|ε(t)|2]=E[S(t) 2 - 2 S(t)L[Y(ξ)] + L[Y(ξ)]2]= E[(S(t)-L[Y(ξ)]) S(t)]

em=E[(S(t)-L[Y(ξ)]) S(t)]

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

18 19 2 21 22 23 24 25 26 27

-3

-2

-1

0

1

2

3

4

Time (s)

Y(t)

e(t)

S(t)

Se(t)

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Determine the impulse response h(ξ) of the filter

bull Use the Minimum mean-square error principle which requires the error S(t)-Ŝ(t) to be Orthogonal (correlation=0) to Y (ξ)

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull If we assume stationarity and time invariance

bull Thereby we ldquojustrdquo need to solve for h(ξ)

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

Fourier transform

Therefor H(f) is the cross correlation between S(t) and Y(t) dived with the power spectrum of Y(t)

cross correlation between S(t) and Y(t)

power spectrum of Y(t)

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull If S(t) and N(t) are statistically independent and zero mean

Therefore H(f) can be determined from the power spectrums of noise and the desired signal

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

100

102

-80

-60

-40

-20

0

Frequency (Hz)

H(f

) dB

Hz

PSD H(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

Sss(f

)+S

nn(f

) dB

Hz

PSD Sss

(f)+Snn

(f)

100

102

-80

-60

-40

-20

0

20

Frequency (Hz)

S(f

) dB

Hz

PSD S(f)

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull The minimum mean-square error can be calculated

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull The h(t) is not causal and thereby is the filter not realizable in real-time

bull There solutions based on spectral factorizations

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

119878119899119899 119891 = 1198730

2120575 120591 119890minus1198952120587119891120591119889120591 =

1198730

2

infin

minusinfin

119878119904119904 119891 = 119890minus120572|120591|119890minus1198952120587119891120591119889120591 =2120572

1205722 + 412058721198912

infin

minusinfin

Wolfram

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Inver Fourier transform

119867 119891 =

2120572

1205722+412058721198912

2120572

1205722+412058721198912+11987302

=4120572

1198730

41205721198730 +1205722+412058721198912 =

119886

1198872+412058721198912

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Different methods for estimation of filter coefficients

ndash Spectrum based bull (Estimate impulse response h(n))

ndash Mean square error bull (Estimate filter coefficients ω(n) )

ω(n)

Y(n)=ω0 X(n)+ ω1 X(n-1)+ ω2 X(n-2)hellip ωM-1 X(n-M+1)

Y(n)=h(0) X(n)+ h(1) ω1 X(n-1)+ h(2) X(n-2)hellip h(M-1)X(n-M+1)

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull As in the continues domain the transfer function of H(z) is the cross spectrum between S(t) and Y(t) dived by the PSD of Y(t)

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

(Real cases)

bull The discrete filter

bull Determine the coefficients 120596 which minimize the Mean square error

119890 119899 = 119878 119899 minus 119878(119899)

119862 120596 = 119864 119890 119899 119890 119899 = 119864 119890 119899 2 = 119864[(119878 119899 minus 119878 119899 )2] Mean square error

Error

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Denote the filter coefficients

120596 = 1205960 1205961 1205962hellip 120596119872minus1

119879

bull Denote the signal

119884(119899) = 119884 119899 119884 119899 minus 1 119884 119899 minus 2 hellip 119884(119899 minus 119872) 119879

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Thereby filter equations can be described using the dot product of the filter coefficients and the signal

119878 119899 = 120596119879119884 119899 = 1205960 1205961 1205962hellip 120596119872minus1

119884 119899119884 119899 minus 1119884 119899 minus 2119884(119899 minus 119872)

Ŝ(n)=ω0 Y(n)+ ω1 Y(n-1)+ ω2 Y(n-2)hellip ωM-1 Y(n-M+1)

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

(continued)

bull Since

119878 119899 = 120596119879119884 119899 =119884 119899 119879120596

bull Mean square error is

bull Which can be expanded to

119862 120596 = 119864 119890 119899 119890 119899 = 119864[ 119878 119899 minus 120596119879119884 119899 (119878 119899 minus 119884 119899 119879120596)]

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

(continued)

bull Expanded Mean square error explained

bull Compact form

119862 120596 = 119864 119878 119899 119878 119899 minus 120596119879119864[119884 119899 119878(119899)] minus 119864[119878 119899 119884(119899)119879]120596+ 120596119879E[119884 119899 119884(119899)119879]120596

Signal variance σs2 Cross correlation vector

between Y(n) and S(n) Rys =[rys(0) rys(1) helliphelliprys(M-1) ]

rys(τ)=E[Y(n+τ)S(n)] τ=012hellipM-1

Transformed version of Rys

Autocorrelation matrix of Y(n)

Ryy=

ryy(0) ryy(1) ryy(2)

ryy(minus1) ryy(0) ryy(1)

ryy(minus2) ryy(minus1) ryy(0)

ryy(τ)=E[Y(n+τ)Y(n)]

It an Toeplitz matrix

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Page 432

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

(continued)

bull The Mean square error is a second order equation

bull Thereby does the equation has a global minimum which can be identified by differentiation according to 120596 and solving for zero

bull The filter coefficients is then easily solved

Page 433-35

119941119914(120654)

119941120654=

119941

119941120654(σs

2 minus 120596119879Rys minus Rys119879

120596+ 120596119879Ryy120596) = minus2Rys+120784Ryy120596 = 0

119862 120596 = σs2 minus 120596119879Rys minus Rys

119879

120596+ 120596119879Ryy120596

Differentiating equation components

119889

119889120596(120596119879Rys)= Rys

119889

119889120596(Rys

119879

120596)= Rys

119889

119889120596(120596119879Ryy120596)= 120784Ryy120596

120654 = Ryy minus120783Rys Wiener-Hopf equation

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Error e(n)=S(n)-YT(n)ω

bull Minimum mean square error

119890119898 = 1205901199042 minus Rys

119879120596 = 1205901199042 minus Rys

119879 Ryy minus120783Rys

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Introduction to Wiener filters

bull Linear filters and orthogonality

bull The time continues Wiener filter

bull The time discrete Wiener filter

bull Example

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Construct a 4th order wiener filter which estimates S(t)

Wiener filter

L[Y(t)] 0 1 2 3 4 5-2

0

2

Time (s)

S(t

)

S(t)

asymp 0 1 2 3 4 5

-5

0

5

Time (s)

Y(t

)

Y(t)

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

-5 0 54000

6000

8000

10000

Ryy

()

ryy(τ)=[9970 5089 4993 5046 4984] τ=[0 hellip4]

Make Autocorrelation matrix

Autocorrelation of Y(t) (M=4) xcorr(Y4)

toeplitz(ryy)

9970 5089 4993 5046 4984 5089 9970 5089 4993 5046 4993 5089 9970 5089 4993 5046 4993 5089 9970 5089 4984 5046 4993 5089 9970

Ryy=

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

Rys(τ)= [5116 5115 5114 5113 5111] τ=[0 hellip4]

Cross correlation of Y(t) and S(t) (M=4) xcorr(SY4)

-5 0 55110

5115

5120

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

ω

bull The filter coefficients is estimated using the Wiener-Hopf equation

120654 = Ryy minus120783Rys

ω =

01683 minus 00359 minus 00323 minus 00342 minus 00323 minus00359 01697 minus 00356 minus 00312 minus 00342 minus00323 minus 00356 01690 minus 00356 minus 00323 minus00342 minus 00312 minus 00356 01697 minus 00359 minus00323 minus 00342 minus 00323 minus 00359 01683

51165115

51145113

5111

=

0172001680016990167701710

Se(n)= 0172 Y(n)+ 01680Y(n-1)+ 01699 Y(n-2)+ 01677 Y(n-3)+ 0171Y(n-4)

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

Ŝ

0 05 1 15 2 25 3 35 4 45 5-3

-2

-1

0

1

2

3

Time (s)

Se(t

)

Se(t)

Se(t)

S(t)

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull When

ndash Both noise and desired signal are stationary processes

ndash You know the desired signal or at least the ideal characteristics of the desired signal

bull In these case the wiener filter is the optimal filter

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull Exercise 78

bull Matlab Exercise

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

bull A blood pressure signal is contaminated by white

noise (Variable name y) The first 8 seconds of

the recording is available in a Noise free version

(Variable name s)

bull Make a FIR filter for filtering of the whole signal

bull Select an appropriate filter order

bull httppersonhstaaudksschmidtSTBPmat

Recommended