Sie sind auf Seite 1von 3

ECE 351

Z-transforms & Filters

Filter Design by Pole-Zero Placement: An Example


Consider the sum of a sinusoid with frequency 1 Hz. and a dc term as shown below: s(t) = sin(2t) + 20 The signal is to be sampled at 5 times the Nyquist rate. We wish to filter out the dc component of the signal, while passing the sinusoid. Nyquist Rate: fN = 2 samples/sec. Sampling Rate: fs = 10 samples/sec. Ts = .1 Frequency to be passed: f = 1 Hz, = 2 = Ts = .2 = /5 Frequency to be rejected: f = 0 Hz, = 0, = 0. A possible pole-zero plot to be used for a 2nd-order filter: Im /5
X

Re
X

(poles at radius .9)

-/5 H(z) = k
( z 1)2 ( z .9e j / 5 )( z .9e j / 5 ) ( z 1)2 z2 (1.8 cos( / 5))z + .81
( z 1)2 z2 .9ze j / 5 .9ze j / 5 + .81

=k

=k

=k

z2 2 z + 1 z2 (1.8 cos( / 5))z + .81

B( z ) A( z )

Choose k so that |H()| = 1 at = /5; see MATLAB code attached. MATLAB Filter function Syntax: yy = filter(bb, aa, xx) where bb denotes the vector of coefficients for the numerator B(z) in H(z); aa denotes the vector of coefficients for the denominator A(z) in H(z); xx denotes the vector of input values; and yy denotes the vector of output values.

D. van Alphen

ECE 351

Z-transforms & Filters

MATLAB code and graphs of the input and output follow. % program ece_351_filter % author: D. van Alphen % class: ECE 351 % this filter is supposed to block a dc signal, and pass a signal at 1 Hz, % when the time spacing is .1 sec. The H(z) was derived in ECE 351: % (H(z) = k [(z-1)^2]/(z^2 - 1.8 cos(pi/5)z + .81) t = [ 0 : .1 : 10]; % time from 0 to 10 sec s = sin(2*pi*t) + 20*ones(1,length(t)); % input sinusoid + dc omega = pi/5; % freq. to be passed z = exp(j*omega); H_num = (z - 1)^2; H_den = z ^2 -1.8*cos(pi/5)*z + .81; display('k = ') k = abs(H_den/H_num); b = k * [1 -2 1]; a = [1 -1.8*cos(pi/5) .81] f = [0 : .1 :10]; H = freqz(b, a, f, 10); % generate transfer function H(f), with fs = 10 plot(f, abs(H)) yy = filter(b, a, s); % calculates output figure subplot(2, 1, 1), plot(t, s), axis([0, 10, 0, 21]), title('Input = s(t)) % plots input subplot(2, 1, 2), plot(t, yy), title('Output = s(t) w/ dc filtered out') % plots output The code determines that k = .2931. The magnitude spectrum is:
|H(f)|

1 0.8 0.6 0.4 0.2 0 0 1 2 f, Hz. 3 4 5

D. van Alphen

ECE 351

Z-transforms & Filters

The input and output are shown below:


Input = s(t) 20 15 10 5 0 0 10 5 2 4 6 8 10

Output = s(t) w/ dc filtered out

-5 0

4 t

10

Note that there is a transient effect evident until the system settles down. Increasing the distance 1 of the poles from zero (now set at .9; max value < 1) will improve the steady-state response, but the transients will take longer to die out. Note that this filter is doing what it was designed to do compare the output to the desired signal, sin(2t), after the transient has settled, and the system is in steadystate.

Recall that the poles must be inside the unit circle for stability.

D. van Alphen

Das könnte Ihnen auch gefallen