overview of discrete time filters discrete time filters
play

Overview of Discrete-Time Filters Discrete-Time Filters Overview - PowerPoint PPT Presentation

Overview of Discrete-Time Filters Discrete-Time Filters Overview First-order filters N M a k y [ n k ] = b k x [ n k ] Ideal filters k =0 k =0 Practical filters M k =0 b k e jwk Y (e j ) k =0 a k e jwk


  1. Overview of Discrete-Time Filters Discrete-Time Filters Overview • First-order filters N M � � a k y [ n − k ] = b k x [ n − k ] • Ideal filters k =0 k =0 • Practical filters � M k =0 b k e − jwk Y (e jω ) k =0 a k e − jwk X (e jω ) = • Frequency-selective filter specifications � N • Ripple versus filter order tradeoff • Discrete-time filters are divided into two categories • Application example – Finite impulse response (FIR) : h [ n ] = 0 for some a and b such that −∞ < a < n < b < + ∞ – Infinite impulse response (IIR) : not FIR • Filters that can be described with difference-equations – FIR: N = 0 – IIR: N > 0 • A simple FIR filter is the moving average filter • A simple IIR filter is the first-order lowpass filter Portland State University ECE 223 DT Filters Ver. 1.03 1 Portland State University ECE 223 DT Filters Ver. 1.03 2 Example 1: First-Order Filters Example 1: Workspace Consider the following filter: y [ n ] − ay [ n − 1] = (1 − a ) x [ n ] 1. Solve for the filter’s transfer function 2. Find the cutoff frequency as a function of a Portland State University ECE 223 DT Filters Ver. 1.03 3 Portland State University ECE 223 DT Filters Ver. 1.03 4

  2. Example 1: Ω c versus a Example 1: H (e jω ) for various a 3.5 1 a=0.1 3 a=0.2 |H(e j ω )| a=0.3 0.5 2.5 a=0.4 ω c (rad/sample) a=0.5 a=0.6 2 0 a=0.7 −3 −2 −1 0 1 2 3 a=0.8 1.5 a=0.9 50 1 ∠ H(e j ω ) ( o ) 0 0.5 −50 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 −3 −2 −1 0 1 2 3 a Frequency (rads/sample) Portland State University ECE 223 DT Filters Ver. 1.03 5 Portland State University ECE 223 DT Filters Ver. 1.03 6 Example 1: Filtered Signals Example 1: MATLAB Code %function [] = FirstOrderApplied(); close all; Intel Closing Daily Price Over 1 Year 36 d = load(’Intel.txt’); % Closing daily price nd = length(d); 34 x = d(nd:-1:1); % Reorder so first element is oldest data n = (0:nd-1)’; % Discrete time index %============================================================================== 32 % Plot the relationship between cutoff frequency and a %============================================================================== x[n], y 0.1 [n], y 0.6 [n] a = 0.00001:0.01:1; 30 wc = acos((1-4*a+a.^2)./(-2*a)); figure 28 FigureSet(1,’LTX’); h = plot(a,wc,’LineWidth’,1.0); ylabel(’\omega_c (rad/sample)’); 26 xlabel(’a’); grid on; box off; 24 AxisSet(8); print -depsc FOCutoff; Raw signal 22 %============================================================================== Cutoff:0.56 % Plot the relationship between cutoff frequency and a %============================================================================== Cutoff:0.11 a = 0.1:0.1:0.9; 20 w = -pi:0.01:pi; H = zeros(length(a),length(w)); 0 50 100 150 200 for cnt = 1:length(a) Time (day) [h,w] = freqz(1-a(cnt),[1 -a(cnt)],w); H(cnt,:) = h; Portland State University ECE 223 DT Filters Ver. 1.03 7 Portland State University ECE 223 DT Filters Ver. 1.03 8

  3. end; for cnt = 2:nd, y2(cnt) = a*y2(cnt-1) + (1-a)*x(cnt); figure end; FigureSet(1,’LTX’); subplot(2,1,1); figure h = plot(w,abs(H)); FigureSet(1,’LTX’); xlim([-pi pi]); h = plot(n,x,’b’,n,y1,’r’,n,y2,’g’); ylim([0 1.05]); set(h,’LineWidth’,0.6); legend(’a=0.1’,’a=0.2’,’a=0.3’,’a=0.4’,’a=0.5’,’a=0.6’,’a=0.7’,’a=0.8’,’a=0.9’,2); ylabel(’x[n], y_{0.1}[n], y_{0.6}[n]’); ylabel(’|H(e^{j\omega})|’); xlabel(’Time (day)’); grid on; title(’Intel Closing Daily Price Over 1 Year’); box off; xlim([0 nd-1]); subplot(2,1,2); ylim([19 36]); h = plot(w,rem(angle(H)*180/pi,180)); box off; xlim([-pi pi]); grid on; ylim([-70 70]); AxisSet(8); ylabel(’\angle H(e^{j\omega}) (^o)’); legend(’Raw signal’,sprintf(’Cutoff:%4.2f’,w1),sprintf(’Cutoff:%4.2f’,w2),4); xlabel(’Frequency (rads/sample)’); print -depsc FOSignalFiltered; grid on; box off; AxisSet(8); print -depsc FOTransferFunctions; %============================================================================== % Filter & Plot %============================================================================== a = 0.58; % cutoff frequency approximately 0.1 w1 = acos((1-4*a+a.^2)./(-2*a)); y1 = zeros(nd,1); for cnt = 2:nd, y1(cnt) = a*y1(cnt-1) + (1-a)*x(cnt); end; a = 0.90; % cutoff frequency approximately 0.1 w2 = acos((1-4*a+a.^2)./(-2*a)); y2 = zeros(nd,1); Portland State University ECE 223 DT Filters Ver. 1.03 9 Portland State University ECE 223 DT Filters Ver. 1.03 10 Ideal Filters Practical Filters • Practical filters are usually designed to meet a set of specifications Lowpass Highpass Notch 1 1 1 • Lowpass and highpass filters usually have the following requirements Ω c Ω c Ω c Ω Ω Ω – Passband range Bandpass Bandstop – Stopband range 1 1 – Maximum ripple in the passband Ω c 1 Ω c 2 Ω Ω c 1 Ω c 2 Ω – Minimum attenuation in the stopband • If we know the specifications, we can ask MATLAB to generate • MATLAB can be used to design standard frequency selective the filter for us filters that meet user-specified requirements • There are four popular types of standard filters • These filters include: lowpass, highpass, bandpass, and bandstop – Butterworth • Unlike continuous-time filters, these must have cutoff frequencies – Chebyshev Type I that range between 0 and π – Chebyshev Type II – Elliptic Portland State University ECE 223 DT Filters Ver. 1.03 11 Portland State University ECE 223 DT Filters Ver. 1.03 12

  4. Ripple Tradeoff Example 2: Lowpass Filter Specifications Design a lowpass filter that meets the following specifications: Filter Order Passband Stopband Butterworth Largest Smooth Smooth • The passband ripple is no more than 0.4455 dB ( 0 . 95 ≤ | H (e jω ) | ≤ 1 ) Chebyshev Type I Moderate Ripple Smooth Chebyshev Type II Moderate Smooth Ripple • The stopband attenuation is at least 26.02 dB ( | H (e jω ) | ≤ 0 . 05 ) Elliptic Lowest Ripple Ripple • The passband ranges from 0– 0 . 2 π rad/sample • The four popular filter types differ in how they satisfy the • The stopband ranges from 0 . 3 π – π rad/sample specifications Plot the magnitude of the resulting transfer function on a linear-linear • In the passband and stopband, each filter is either smooth or plot, the impulse response, and the step response. Try the contains ripple Butterworth, Chebyshev I, Chebyshev II, and elliptic filters. • Elliptic filters are also called equiripple filters and Cauer filters Portland State University ECE 223 DT Filters Ver. 1.03 13 Portland State University ECE 223 DT Filters Ver. 1.03 14 Example 3: Butterworth Lowpass Example 3: Butterworth Lowpass Butterworth Lowpass Filter Transfer Function Order: 10 Butterworth Lowpass Filter Impulse Response Order:10 0.25 1 0.2 0.8 0.15 0.6 0.1 |H(e j ω )| h[n] 0.05 0.4 0 0.2 −0.05 0 −0.1 0 0.5 1 1.5 2 2.5 3 0 10 20 30 40 50 60 70 80 90 100 Frequency (rad/sample) Time (n) Portland State University ECE 223 DT Filters Ver. 1.03 15 Portland State University ECE 223 DT Filters Ver. 1.03 16

  5. Example 3: Butterworth Lowpass Example 3: Chebyshev-I Lowpass Butterworth Lowpass Filter Step Response Order:10 Chebyshev−I Lowpass Filter Transfer Function Order: 5 1.4 1 1.2 0.8 1 0.8 0.6 |H(e j ω )| h[n] 0.6 0.4 0.4 0.2 0.2 0 0 0 10 20 30 40 50 60 70 80 90 100 0 0.5 1 1.5 2 2.5 3 Time (n) Frequency (rad/sample) Portland State University ECE 223 DT Filters Ver. 1.03 17 Portland State University ECE 223 DT Filters Ver. 1.03 18 Example 3: Chebyshev-I Lowpass Example 3: Chebyshev-I Lowpass Chebyshev−I Lowpass Filter Impulse Response Order:5 Chebyshev−I Lowpass Filter Step Response Order:5 0.25 1.4 0.2 1.2 0.15 1 0.1 0.8 h[n] h[n] 0.05 0.6 0 0.4 −0.05 0.2 −0.1 0 0 10 20 30 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100 Time (n) Time (n) Portland State University ECE 223 DT Filters Ver. 1.03 19 Portland State University ECE 223 DT Filters Ver. 1.03 20

  6. Example 3: Chebyshev-II Lowpass Example 3: Chebyshev-II Lowpass Chebyshev−II Lowpass Filter Transfer Function Order: 5 Chebyshev−II Lowpass Filter Impulse Response Order:5 0.25 1 0.2 0.8 0.15 0.6 0.1 |H(e j ω )| h[n] 0.05 0.4 0 0.2 −0.05 0 −0.1 0 0.5 1 1.5 2 2.5 3 0 10 20 30 40 50 60 70 80 90 100 Frequency (rad/sample) Time (n) Portland State University ECE 223 DT Filters Ver. 1.03 21 Portland State University ECE 223 DT Filters Ver. 1.03 22 Example 3: Chebyshev-II Lowpass Example 3: Elliptic Lowpass Chebyshev−II Lowpass Filter Step Response Order:5 Elliptic Lowpass Filter Transfer Function Order: 4 1.4 1 1.2 0.8 1 0.8 0.6 |H(e j ω )| h[n] 0.6 0.4 0.4 0.2 0.2 0 0 0 10 20 30 40 50 60 70 80 90 100 0 0.5 1 1.5 2 2.5 3 Time (n) Frequency (rad/sample) Portland State University ECE 223 DT Filters Ver. 1.03 23 Portland State University ECE 223 DT Filters Ver. 1.03 24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend