Download presentation
Presentation is loading. Please wait.
Published byLesley McCoy Modified over 9 years ago
1
DCSP-15: Matched Filter Jianfeng Feng Department of Computer Science Warwick Univ., UK Jianfeng.feng@warwick.ac.uk http://www.dcs.warwick.ac.uk/~feng/dcsp.html
2
Filters Stop or allow to pass for certain signals
3
There are four main classes of filter in widespread use: filters. The name are self-explanatory This four types are shown in the next figure Filter Types Lowpass highpass bandpass bandstop
4
Filter Types: TFs
5
General Filter Design Using Chebyshev or Butterworth polynomials to approximate a square wave function in the frequency domain Any function can be approximated by a polynomials. Optimal filter design aims to minimize these ripples We are not discussing them here in details, but the principle is the same as our simple filter Ideal case Polynomial approximation
6
Filters Stop or allow to pass for certain signals as we have talked before Detect certain signals such as radar etc (pattern recognitions)
7
Ex: Detect it when it comes close
8
Matched filters: Question Assume that we can detect S = (s 1, s 2, s 3, s 4, s 5 s 6 ) To find a i y(0) = a 0 x(0)+ a 1 x(-1)+a 2 x(- 2) + a 3 x(-3) + a 4 x(-4) +a 5 x(-5) so that we can find S, more precisely Y(0) = a 0 s 6 + a 1 s 5 + a 2 s 4 + a 3 s 3 + a 4 s 2 + a 5 s 1
9
At time -5 we have x(-5) = S 1 =1 (length ) detector Y(-5) = a 0 1 + a 1 x(-6) + a 2 x(-7) + a 3 x(-8) + a 4 x(-9) + a 5 x(-10)
10
At time -4 we have x(-4) = S 2 = 2 (length ) detector Y(-5) = a 0 1 + a 1 x(-6) + a 2 x(-7) + a 3 x(-8) + a 4 x(-9) + a 5 x(-10) Y(-4) = a 0 2 + a 1 1 + a 2 x(-6) + a 3 x(-7) + a 4 x(-8) + a 5 x(-9)
11
At time -3 we have x(-3) = S 3 = 3 (length ) detector Y(-5) = a 0 1 + a 1 x(-6) + a 2 x(-7) + a 3 x(-8) + a 4 x(-9) + a 5 x(-10) Y(-4) = a 0 2 + a 1 1 + a 2 x(-6) + a 3 x(-7) + a 4 x(-8) + a 5 x(-9) Y(-3) = a 0 3 + a 1 2 + a 2 1 + a 3 x(-4) + a 4 x(-5) + a 5 x(-6)
12
At time -2 we have x(-2) = S 4 = 4 (length ) detector
13
At time -1 we have x(-1) = S 5 = 8 (length ) detector
14
At time 0 we have x(0) = S 6 = 6 (length ) detector
15
Signal The input signal is S = (s 1, s 2, s 3, s 4, s 5, s 6 ) = ( 1, 2, 3, 4, 8, 6)
16
Matched filters: Question To find a i y(0) = a 0 6 + a 1 8 +a 2 4 +a 3 3 + a 4 2 +a 5 1 to detect that S = (s 1, s 2, s 3, s 4, s 5 s 6 ) is here
17
Matched filters: visulization a 0 x(0) + a 1 x(-1) + a 2 x(- 2) + a 3 x(-3) + a 4 x(-4) + a 5 x(-5) = y(0) Matched Matched !!!! incoming signals is matched by the coefficients a 5
18
Data requirement Without loss of generality, we can assume that (normalized signals) and we can assume that (normalized coefficients)
19
Remember that If and only if a i = s N-I for all I which essentially says that the coefficients a and the incoming signal s are identical ( matched, a i = s N-i ). Or equivalently a 0 S N + a 1 S N-1 + …. + a N-1 S 1 = 1 if and only if a i = s N-I for all i a 0 S N + a 1 S N-1 + …. + a N-1 S 1 < 1 otherwise Ideas
20
Define a i = s N-i (reversing the order) y(n) = a 0 x(n) + a 1 x(n-1) + … + a N x(n-N) So when the signal arrives we have y(n) = S N x(n) + S N-1 x(n-1) + … + S 1 x(n-N) = S N S N + S N-1 S N-1 + … + S 1 S 1 Matched filter
21
At time -5 we have y(-5) =0.0877* 0.5262=0.0461 Y(-5) = a 0 x(-5)+a 1 x(-6) +… 0.5262 0.0877 0.7016 0 detector S= (0.0877 0.1754 0.2631 0.3508 0.7016 0.5262) a = (0.5262 0.7016 0.3508 0.2631 0.1754 0.0877) x=( s 1 0 0 0 0 0 )
22
Y(-4) = a 0 x(-4)+a 1 x(-5)+a 2 x(-6)+…=0.1538 0.5262 0.1754 0.7016 0.0877 0.2631 0 detector S= (0.0877 0.1754 0.2631 0.3508 0.7016 0.5262) a = (0.5262 0.7016 0.3508 0.2631 0.1754 0.0877) s 2 s 1 0 0 0 0
23
At time -3 we have Y(-3) = a 0 x(-3)+a 1 x(-4)+a 2 x(-5)+a 3 x(-6)…=.2923 0.5262 0.2631 0.7016 0.1754 0.3508 0.0877 0.2631 0 detector S= (0.0877 0.1754 0.2631 0.3508 0.7016 0.5262) a = (0.5262 0.7016 0.3508 0.2631 0.1754 0.0877) s 3 s 2 s 1 0 0 0
24
At time -2 we have Y(-2) = a 0 x(-2) +a 1 x(-3) +a 2 x(-4) +a 3 x(-5)+a 4 x(-6)…= 0.5262 0.3508 0.7016 0.2631 0.3508 0.1754 0.2631 0.3508 detector S= (0.0877 0.1754 0.2631 0.3508 0.7016 0.5262) a = (0.5262 0.7016 0.3508 0.2631 0.1754 0.0877) s 4 s 3 s 2 s 1 0 0
25
At time -1 we have y(-1) = a 0 x(-1)+a 1 x(-2)+a 2 x(-3)+a 3 x(-4)+a 4 x(-5)… detector S= (0.0877 0.1754 0.2631 0.3508 0.7016 0.5262) a = (0.5262 0.7016 0.3508 0.2631 0.1754 0.0877) s 5 s 4 s 3 s 2 s 1 0
26
detector S= (0.0877 0.1754 0.2631 0.3508 0.7016 0.5262) a = (0.5262 0.7016 0.3508 0.2631 0.1754 0.0877) s 6 s 5 s 4 s 3 s 2 s 1 At time 0 we have Y(0) = a 0 x(0) + a 1 x(-1) + a 2 x(-2) + a 3 x(-3) + a 4 x(-4) + a 5 x(-5) + a 6 x(-6) = 1
27
detector S= (0.0877 0.1754 0.2631 0.3508 0.7016 0.5262) a = (0.5262 0.7016 0.3508 0.2631 0.1754 0.0877) 0 s 6 s 5 s 4 s 3 s 2 s 1 At time 1 we have y(1) = a 0 x(1) + a 1 x(0) + a 2 x(-1) + a 3 x(-2) + a 4 x(-3) + a 5 x(-4) + a 6 x(-5) = 0.7961
28
Matched Filter Outcome
29
Matlab Demo Matched-filter- demo It is a simple idea, but useful A bit theory first
30
Auto-correlation function Auto-correlation Function
31
Detection theory A means to quantify the ability to discern between information-bearing patterns and noise Patterns: stimulus in human, signal in machines Noise: random patterns that distract from the information
32
Can it be useful? Any signal here?
33
Filter output
34
s=rand(1,100); s=s/sqrt(s*s'); a=s; k=100; N=100*k; sigma=0.2; x=randn(1,N)*sigma; signal=zeros(1,N); for i=3*N/k+1:N*4/k x(i)=a(i-3*N/k)+x(i); signal(i)=a(i-3*N/k); end for i=1:N*(k-1)/k c(i)=x([i:i+N/k-1])*s'; end figure(1) plot(x); hold on plot(signal,'r'); figure(2) plot(c)
35
Matched filter The result is amazing It depends on SNR We will not go into details, but you might be able to investigate it using Matlab
36
RGB = imread(‘bush.png'); I = rgb2gray(RGB); J = imnoise(I,'gaussian',0, 0.005); K = wiener2(J,[5 5]); figure, imshow(J), figure, imshow(K) Tomorrow
37
DCSP-16: Wiener Filter and Kalman Filter* Jianfeng Feng Department of Computer Science Warwick Univ., UK Jianfeng.feng@warwick.ac.uk http://www.dcs.warwick.ac.uk/~feng/dcsp.html
38
Father of cybernetics Norbert Wiener: Harvard awarded Wiener a PhD, when he was 17.
39
The RGB format stores three color values, R, G and B, for each pixel. RGB = imread(‘bush.png'); size(RGB) ans = 1500 1200 3 imshow(RGB) Example
41
Setup Recorded signal x(n,m) = s(n,m) + (n,m) for example, an image of 1500 X1200 True Signal noise
42
RGB = imread(‘bush.png'); I = rgb2gray(RGB); J = imnoise(I,'gaussian',0,0.0 05); figure, imshow(I), figure, imshow(J) Setup
43
To find a constant a(m,n) such that E ( a(m,n) x(m,n) – s(m,n) ) 2 as small as possible y(m,n) = a(m,n) x(m,n) Different from the filter before, a(m,n) depends on (m,n) : Adaptive filter Setup
44
The quanttity above is minimized if the derivative of it with respect to a is zero Setup (optimal Wiener gain)
45
Without loss of generality, we assume that Es=0 E =0 for simplicity of formulation. S, are independent Setup
46
The filtered output is given by Note that the coefficient a depends on the position is the local variance, E 2 is the global variance (noise) Algorithm
47
where summation is over an area of N and M 3X 3 area (N=3, M=3) Algorithm
48
Algorithm in Matlab wiener2 lowpass - filters an intensity image that has been degraded by constant power additive noise. wiener2 uses a pixelwise adaptive Wiener method based on statistics estimated from a local neighborhood of each pixel.
49
RGB = imread(‘bush.png'); I = rgb2gray(RGB); J = imnoise(I,'gaussian',0, 0.005); K = wiener2(J,[5 5]); figure, imshow(J), figure, imshow(K) Example
50
Large M and N reduce noise, but blur the photo small M and N will not affect noise optimal size should be used Further issues N=M=50 N=M=2
51
A more general version of Wiener: Kalman filter Kaman filter is widely used in many areas (still a very hot research topic) As an introductory course, we only give you a taste of its flavour Further issues
52
Kalman Filter: find out x k Have two variables state variable x which is not observable x k = F k x k-1 + B k u k + w k Observable variable z which we can observe, but is contaminated by noise z k = H k x k +v k where w k ~ N(0,Q k ) and v k ~ N(0,R k ) are noise, F k and H k are constants. X k-1 Input u k BkBk Output x k
53
Kalman Filter For given x k-1|k-1 and p K-1|K-1 Predict Predicted (a priori) state estimate x k|k-1 = F k-1 x k-1|k-1 +B k u k Predicted (a priori) estimate covariance p k|k-1 = F k-1 p k-1 |k-1 F K-1 +Q K Update measurement residual y k = z k –H k X k|k-1 measurement residual covariance S k = H k P k|k-1 H K +R k optimal Kalman gainK k = P k|k-1 H k (S K ) -1 updated (a posteriori) state estimate X k|k = x k|k-1 + K k y k updated (a posteriori) estimate covariance p K|K = (I-K k H k ) P k|k-1
54
Kalman Filter It is one of the most useful filters in the literature, as shown below We do not have time to go further, but do read around clear all close all N=1000; q=1; r=1; f=0.1; h=0.2; x(1)=0.5; xsignal(1)=0.5; xhat=zeros(1,N+1); phat=zeros(1,N+1); xhat(1)=x(1); phat(1)=x(1); p(1)=1; z(1)=0.1; y(1)=1; for i=1:N xsignal(i+1)=f*xsignal(i)+randn(1,1)*sqrt(q)+1*cos(2*pi*0.01*i); z(i+1)=h*xsignal(i)+randn(1,1)*sqrt(r); end for i=1:N x(i+1)=f*xhat(i)+1*cos(2*pi*0.01*i); p(i+1)=f*phat(i)*f+q; y(i+1)=z(i+1)-h*x(i+1); s(i+1)=h*p(i+1)*h+r; k(i+1)=p(i+1)*h/s(i+1); atemp=x(i+1)+k*y(i+1); xhat(1,i+1)=atemp(1,i+1); atemp=(1-k*h)*p(i+1); phat(i+1)=atemp(1,i+1); clear atemp end plot(xsignal); hold on plot(xhat,'r') plot(z,'g') plot(xhat,'r')
55
Applications Attitude and Heading Reference Systems Autopilot Battery state of charge (SoC) estimation [1][2] Brain-computer interface Chaotic signals Tracking and Vertex Fitting of charged particles in Particle Detectors [35] Tracking of objects in computer vision Dynamic positioning Economics, in particular macroeconomics, time series, and econometrics Inertial guidance system Orbit Determination Power system state estimation Radar tracker Satellite navigation systems Seismology [3] Sensorless control of AC motor variable-frequency drives Simultaneous localization and mapping Speech enhancement Weather forecasting Navigation system 3D modeling Structural health monitoring Human sensorimotor processing[36] Flight control unit of an Airbus A340 modern weather forecasting.
56
Final slide Information theory FT (continuous, discrete, discrete +finite) Filters (band related filters, matched, Wiener + Kalman) No lectures next week, but drop me a line if you need help for your assignment
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.