Optimum FIR Filters Definitions Suppose we have a univariate random - - PowerPoint PPT Presentation

optimum fir filters definitions suppose we have a
SMART_READER_LITE
LIVE PREVIEW

Optimum FIR Filters Definitions Suppose we have a univariate random - - PowerPoint PPT Presentation

Optimum FIR Filters Definitions Suppose we have a univariate random signal x ( n ) that is observed and Definitions we wish to estimated y ( n ) Design and properties y ( n ) = h ( n, k ) x ( n ) Nonstationary case M 1


slide-1
SLIDE 1

Why Focus on FIR Filters? Why not consider IIR filters that include PZ and AZ representations, rather than just FIR filters (AP systems)?

  • FIR filters are stable
  • They approximate most IIR filters well, if the order is high enough
  • Optimal coefficients can be found by solving linear set of equations

Note that we have not yet assumed stationarity or ergodicity

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

3

Optimum FIR Filters

  • Definitions
  • Design and properties
  • Nonstationary case
  • Stationary case
  • Example
  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

1

Nonstationary Case We can apply the same solution as the more general case to solve for the coefficient vector E[x(n)eo(n)] = 0 E[x(n)[y(n) − c∗

  • (n)x(n)]H] = 0

E[x(n)[y(n)∗ − x(n)Hco(n)]] = 0 R(n)co(n) = d(n) Po(n) = Py(n) − dH(n)co(n) where R(n) E[x(n)xH(n)] d(n) E[x(n)y∗(n)]

  • Note that this is a time varying solution
  • Coefficients must be obtained at every sample time n
  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

4

Definitions Suppose we have a univariate random signal x(n) that is observed and we wish to estimated y(n) ˆ y(n) = h(n, k) ∗ x(n) =

M−1

  • k=0

h(n, k)x(n − k) =

M

  • k=1

c∗

k(n)x(n − k + 1)

= cH(n)x(n) c(n) = c1(n) c2(n) . . . cM(n)T x(n) =

  • x(n)

x(n − 1) . . . x(n − (M − 1)) T

  • Again, c(n) is called the coefficient or parameter vector
  • x(n) is called the input data vector or simply input vector
  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

2

slide-2
SLIDE 2

Stationary Case: Correlation Matrix Consider the definitions of the auto- and cross-correlation matrices x(n) =

  • x(n)

x(n − 1) . . . x(n − M + 1) T R E[x(n)x(n)H] = ⎡ ⎢ ⎣

E[x(n)x∗(n)] E[x(n)x∗(n-1)] . . . E[x(n)x∗(n-M+1)] E[x(n-1)x∗(n)] E[x(n-1)x∗(n-1)] . . . E[x(n-1)x∗(n-M+1)] . . . . . . ... . . . E[x(n-M+1)x∗(n)] E[x(n-M+1)x∗(n-1)] . . . E[x(n-M + 1)x∗(n-M+1)]

⎤ ⎥ ⎦ = ⎡ ⎢ ⎢ ⎢ ⎣ rx(0) rx(1) . . . rx(M − 1) r∗

x(1)

rx(0) . . . rx(M − 2) . . . . . . ... . . . r∗

x(M − 1)

r∗

x(M − 2)

. . . rx(0) ⎤ ⎥ ⎥ ⎥ ⎦ = RH R becomes toeplitz

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

7

Comparison with Frequency-Selective Filters ˆ y(n) =

M−1

  • k=0

h(n, k)x(n − k) =

M

  • k=1

c∗

k(n)x(n − k + 1)

  • Convention frequency-selective filters attenuate specified

frequency bands and amplify others – These are designed given a set of specifications (e.g., stopband attenuation, passband rippled, transition bands) – Do not depend on data

  • “Optimum filters” are designed using the statistical properties of

the signals (second-order moments) – Work well on all signals with those second-order moments – Note that these do not use any phase information about the input signal

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

5

Stationary Case: Cross-Correlation Vector x(n) = x(n) x(n − 1) . . . x(n − M + 1) d E[x(n)y∗(n)] = ⎡ ⎢ ⎣ E[x(n)y∗(n)] E[x(n − 1)y∗(n)] . . . E[x(n − M + 1)y∗(n)] ⎤ ⎥ ⎦ = ⎡ ⎢ ⎢ ⎢ ⎣ rxy(0) rxy(−1) . . . rxy(−M + 1) ⎤ ⎥ ⎥ ⎥ ⎦ = ⎡ ⎢ ⎢ ⎢ ⎣ r∗

yx(0)

r∗

yx(1)

. . . r∗

yx(M − 1)

⎤ ⎥ ⎥ ⎥ ⎦ where we used rxy(ℓ) = E[x(n)y∗(n − ℓ)] = E[y(n)x∗(n + ℓ)]∗ = r∗

yx(−ℓ)

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

8

Performance Surface P(c(n)) = Py(n) − cH(n)d(n) − dH(n)c(n) + cH(n)R(n)c(n)

  • Again, the error surface is a quadratic bowl
  • If signal is nonstationary, the bottom of the bowl changes over

time

  • In many cases, the statistics drift slowly
  • Our goal then is to track the bottom of the bowl
  • Adaptive filters primarily solve this problem
  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

6

slide-3
SLIDE 3

Example 1: Work Space

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

11

Stationary Case Solution and Impulse Response Rco = d Po = Py − dHco ˆ yo(n) =

M−1

  • k=0

ho(k)x(n − k) cH

  • ,n+1 = ho(n)
  • The estimator and second-order statistics are no longer

time-varying

  • R becomes toeplitz, as well as Hermitian and non-negative definite
  • Optimum filter is time-invariant
  • On average (across realizations) performs better than any other

linear filter of the same order

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

9

Example 1: Pole Zero Plots

−1 −0.5 0.5 1 −1 −0.5 0.5 1 AZ System −1 −0.5 0.5 1 −1 −0.5 0.5 1 Estimator

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

12

Example 1: MA Process Create a synthetic MA process in MATLAB. Plot the pole-zero and transfer function plots of the system and the one-step ahead predictor. Plot the MMSE versus the filter order M. For all other examples, use M = 25.

  • Draw a block diagram of the process and the estimator
  • What can you conclude about the relationship between the MA

process and the estimator impulse response?

  • Is the estimator stable?
  • Why can’t we make the MSE → 0 as M → ∞?
  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

10

slide-4
SLIDE 4

Example 1: Predicted Segment

10 20 30 40 50 60 70 80 90 100 −4 −3 −2 −1 1 2 3 4 5 Time (Samples Output (scaled) Actual Predicted

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

15

Example 1: Impulse Responses

5 10 15 20 25 −1 1 Lag (samples) Impulse Response 5 10 15 20 25 −1 1 Lag (samples) Impulse Response

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

13

Example 1: MMSE Versus Filter Order 20 40 60 80 100 0.5 1 1.5 2 2.5 Filter Order MMSE

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

16

Example 1: Transfer Functions

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1 2 3 Frequency (normalized) |H(ejω)| 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1 2 3 Frequency (normalized) |H(ejω)|

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

14

slide-5
SLIDE 5

Example 1: MATLAB Code

%================================================ % Plot the Pole Zero Plot of the System %================================================ figure; h = Circle; hold on; h = plot(real(roots(b)),imag(roots(b)),’bo’); set(h,’LineWidth’,1.2); xlim([-1.2 1.2]); ylim([-1.2 1.2]); axis(’square’); title(’AZ System’); box off; %================================================ % Plot the Pole Zero Plot of the Estimator %================================================ figure; h = Circle; hold on; h = plot(real(roots(co)),imag(roots(co)),’go’); set(h,’LineWidth’,1.2); xlim([-1.2 1.2]); ylim([-1.2 1.2]); axis(’square’); title(’Estimator’); box off;

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

19

Example 1: MATLAB Code

N = 10000; % Number of samples M = 25; % Size of filter b = poly([0.99 0.98*j -0.98*j 0.98*exp(j*0.8*pi) 0.98*exp(-j*0.8*pi)]); % Locations of zeros nz = length(b)-1; % Number of zeros Mmax = 100; % Maximum value to consider %================================================ % Calculate the Auto- and Cross-Correlation %================================================ rx = conv(b,fliplr(b)); % Quick calculation of rx k = -nz:nz; rx = rx(nz+1:end); % Trim off negative lags ryx = rx(2:end); % Cross-correlation one-step ahead %================================================ % Build R and d and Solve for co %================================================ R = zeros(Mmax,Mmax); for c1=1:Mmax, i1 = 1:nz+1; i2 = c1+(0:nz); i1 = i1(find(i2<=Mmax)); i2 = i2(find(i2<=Mmax)); R(c1,i2) = rx(i1); R(i2,c1) = rx(i1).’; end; d = zeros(Mmax,1); for c1=1:nz, d(c1) = rx(c1+1); end;

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

17

Example 1: MATLAB Code

%================================================ % Plot the Frequency Response %================================================ figure; subplot(2,1,1); [H,w] = freqz(b,1,2^10); h = plot(w/pi,abs(H),’b’); set(h,’LineWidth’,1.2); set(get(gca,’YLabel’),’Interpreter’,’LaTeX’) xlabel(’Frequency (normalized)’); ylabel(’$|H(e^{j\omega})|$’); xlim([0 1]); ylim([0 1.05*max(abs(H))]); subplot(2,1,2); [H,w] = freqz(co,1,2^10); h = plot(w/pi,abs(H),’g’); set(h,’LineWidth’,1.2); set(get(gca,’YLabel’),’Interpreter’,’LaTeX’) xlabel(’Frequency (normalized)’); ylabel(’$|H(e^{j\omega})|$’); xlim([0 1]); ylim([0 1.05*max(abs(H))]); box off;

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

20

Example 1: MATLAB Code

Po = zeros(Mmax,1); for c1=Mmax:-1:1, Rt = R(1:c1,1:c1); dt = d(1:c1); co = inv(Rt)*dt; Po(c1) = rx(1) - dt’*co; end; %================================================ % Plot the Pole Zero Plot of the System %================================================ figure; h = stem(1:Mmax,Po,’r.’); set(h,’MarkerFaceColor’,’r’); xlabel(’Filter Order’); ylabel(’MMSE’); xlim([0 Mmax+0.5]); box off; %================================================ % Calculate Optimal filter and MMSE %================================================ R = R(1:M,1:M); d = d(1:M); co = inv(R)*d; Po = rx(1) - d’*co; %================================================ % Generate Example %================================================ w = randn(N,1); x = filter(b,1,w); xhp = filter(co,1,x);

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

18

slide-6
SLIDE 6

Example 1: MATLAB Code

%================================================ % Plot the Impulse Response %================================================ figure; subplot(2,1,1); h = stem([b,zeros(1,M-length(b))],’b’); set(h,’MarkerFaceColor’,’b’); set(h,’MarkerSize’,2); set(h,’LineWidth’,0.8); xlabel(’Lag (samples)’); ylabel(’Impulse Response’); xlim([0 M]); subplot(2,1,2); [H,w] = freqz(co,1,2^10); h = stem(co,’g’); set(h,’MarkerFaceColor’,’g’); set(h,’MarkerSize’,2); set(h,’LineWidth’,0.8); xlabel(’Lag (samples)’); ylabel(’Impulse Response’); xlim([0 M]);

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

21

Example 1: MATLAB Code

%================================================ % Plot the Actual and Predicted Values %================================================ figure; k = 1:N; h = plot(k,x,’b’,k+1,xhp,’g’); set(h,’LineWidth’,1.2); xlabel(’Time (Samples’); ylabel(’Output (scaled)’); legend(h,’Actual’,’Predicted’); xlim([0 100]);

  • J. McNames

Portland State University ECE 539/639 Optimum FIR Filters

  • Ver. 1.02

22