Chapter 3: State of the Art
3. Physical Structures
The frequency-based analysis introduced in the last chapter is a most useful tool for analyzing systems or responses in which the waveforms are periodic or aperiodic, but cannot be applied to transient responses of infinite length, such as step functions, or systems with nonzero initial conditions. These shortcomings motivated the development of the Laplace transform in the analog domain. La-place analysis uses the complex variable s (s= σ + jω) as a representation of
complex frequency in place of jω in the Fourier transform. The Z-transform is a digital operation analogous to the Laplace transform in the analog domain, and it is used in a similar manner. The Z-transform is based around the complex variable, z, where z is an arbitrary complex number,*z* ejω. This variable is also termed the complex frequency, and as with its time domain counterpart, the Laplace variable s, it is possible to substitute ejω for z to perform a strictly sinusoidal analysis.*
The Z-transform follows the format of the general transform equation (Eq.
(7)) and is also similar to the Fourier transform equation (Eq. (6)):
X(z)= Z[x(n)] =䉭
∑
∞n=−∞
x(n) Z−n (1)
where z= an arbitrary complex variable. Note that the probing function for this transform is simply z−n. In any real application, the limit of the summation will be finite, usually the length of x(n).
When identified with a data sequence, such as x(n) above, z−nrepresents an interval shift of n samples, or an associated time shift of nTs seconds. Note that Eq. (1) indicates that every data sample in the sequence x(n) is associated with a unique power of z, and this power of z defines a sample’s position in the sequence. This time shifting property of z−ncan be formally stated as:
Z(x(n− k))] = z−kZ(x(n)) (2)
For example, the time shifting characteristic of the Z-transform can be used to define a unit delay process, z−1. For such a process, the output is the same as the input, but shifted (or delayed) by one data sample (Figure 4.1).
Digital Transfer Function
As in Laplace transform analysis, one of the most useful applications of the Z-transform lies in its ability to define the digital equivalent of a transfer function.
FIGURE 4.1 A unit delay process shifts the input by one data sample. Other powers of z could be used to provide larger shifts.
*If*z* is set to 1, then z = ejω. This is called evaluating z on the unit circle. See Bruce (2001) for a thorough discussion of the properties of z and the Z-transform.
By analogy to linear system analysis, the digital transfer function is defined as:
H(z)= Y(z)
X(z) (3)
For the simple example ofFigure 4.1,the digital transfer function would be: H(z)= z−1. Of course, most transfer functions will be more complicated, including polynomials of z in both the numerator and denominator, just as ana-log transfer functions contain polynomials of s:
H(z)=b0+ b1z−1+ b2z−2+ ⴢⴢⴢ + bNz−N
1+ a1z−1+ a2z−2+ ⴢⴢⴢ + bDz−D (4) While H(z) has a structure similar to the Laplace domain transfer function H(s), there is no simple relationship between them. For example, unlike analog sys-tems, the order of the numerator, N, need not be less than, or equal to, the order of the denominator, D, for stability. In fact, systems that have a denominator order of 1 are more stable that those having higher order denominators.
From the digital transfer function, H(z), it is possible to determine the output given any input. In the Z-transform domain this relationship is simply:
Y(z)= H(z) X(z) = X(z)
∑
N−1The input–output or difference equation analogous to the time domain equation can be obtained from Eq. (5) by applying the time shift interpretation to the term z−n:
This equation assumes that a(0)= 1 as specified in Eq. (4). We will find that Eq. (6) is similar to the equation representing other linear processes such as the ARMA model in Chapter 5 (Eq. (3), Chapter 5). This is appropriate as the ARMA model is a linear digital process containing both denominator terms and numerator terms.*
All basic digital filters can be interpreted as linear digital processes, and, in fact, the term digital filter is often used interchangeably with digital systems (Stearns and David, 1996). Filter design, then, is simply the determination of
*Borrowing from analog terminology, the terms poles is sometimes uses for denominator coeffi-cients and zeros for numerator coefficoeffi-cients.
the appropriate filter coefficients, a(n) and b(n), that provide the desired spectral shaping. This design process can be aided by MATLAB routines that can gener-ate the a(n) and b(n) coefficients of Eq. (6) given a desired frequency response.
If the frequency spectrum of H(z) is desired, it can be obtained from a modification of Eq. (5) substituting z= ejω:
where fft indicates the Fourier transform. As with all Fourier transforms, fre-quency can be obtained from the variable m by multiplying by fs/N or 1/(NTs).
MATLAB Implementation
Many MATLAB functions used in filter design and application can also be used in digital transfer function analysis. The MATLAB routine filter described below uses Eq. (6) to implement a digital filter, but can be used to implement a linear process given the Z-transform transfer function (see Example 4.1). With regard to implementation, note that if the a(R) coefficients in Eq. (6) are zero (with the exception of a(0)= 1), Eq. (6) reduces to convolution (see Eq. (15) inChapter 2).
The function filterdetermines the output, y(n), to an input, x(n), for a linear system with a digital transfer function as specified by the a and b coeffi-cients. Essentially this function implements Eq. (6). The calling structure is:
y = filter(b,a,x)
wherexis the input,ythe output, andbandaare the coefficients of the transfer function in Eq. (4).
Example 4.1 Find and plot the frequency spectrum and the impulse re-sponse of a digital linear process having the digital transfer function:
H(z)= 0.2+ 0.5z−1 1− 0.2z−1+ 0.8z−2
Solution: Find H(z) using MATLAB’s fft. Then construct an impulse func-tion and determine the output using the MATLABfilterroutine.
% Example 4.1 andFigures 4.2and4.3
% Plot the frequency characteristics and impulse response
FIGURE4.2 Plot of frequency characteristic (magnitude and phase) of the digital transfer function given above.
% of a linear digital system with the given digital
% transfer function
% Assume a sampling frequency of 1 kHz
%
close all; clear all;
fs = 1000; % Sampling frequency
N = 512; % Number of points
% Define a and b coefficients based on H(z)
a = [1−.2 .8]; % Denominator of transfer
% function
b = [.2 .5]; % Numerator of transfer function
%
% Plot the Frequency characteristic of H(z) using the fft H = fft(b,N)./fft(a,N); % Compute H(f)
FIGURE4.3 Impulse response of the digital transfer function described above.
BothFigure 4.2and Figure 4.3 were generated using the MATLAB code given in Example 1.
Hm = 20*log10(abs(H)); % Get magnitude in db Theta = (angle(H)) *2*pi; % and phase in deg.
f = (1:N/2) *fs/N; % Frequency vector for plotting
%
subplot(2,1,1);
plot(f,Hm(1:N/2),’k’); % Plot and label mag H(f) xlabel (’Frequency (Hz)’); ylabel(’*H(z)* (db)’);
grid on; % Plot using grid lines subplot(2,1,2);
plot(f,Theta(1:N/2),’k’); % Plot the phase xlabel (’Frequency (Hz)’); ylabel(’Phase (deg)’);
grid on;
%
%
% Compute the Impulse Response
x = [1, zeros(1,N-1)]; % Generate an impulse function y = filter(b,a,x); % Apply b and a to impulse using
% Eq. (6)
figure; % New figure t = (1:N)/fs;
plot(t(1:60),y(1:60),’k’); % Plot only the first 60 points
% for clarity
xlabel(’Time (sec)’); ylabel (’Impulse Response’);
The digital filters described in the rest of this chapter use a straightforward application of these linear system concepts. The design and implementation of digital filters is merely a question of determining the a(n) and b(n) coefficients that produce linear processes with the desired frequency characteristics.