You are on page 1of 39

Filters and Transfer Functions

The z-transform Y(z) of a digital filter's output y(n) is related to the z-transform X(z) of the input x(n) by filter transfer function H(z) as:

where H(z) is the filter's transfer function.

Here, the constants b(i) and a(i) are the filter coefficients and the order of the filter is the maximum of N and M.

Filter Coefficients and Filter Names


When M = 0 (that is, b is a scalar), the filter is an
Infinite Impulse Response (IIR), all-pole, recursive, autoregressive(AR) filter.

When N = 0, the filter is a Finite Impulse Response


(FIR), all-zero, non recursive, or moving-average (MA) filter.

If both M and N are greater than zero, the filter is


an IIR, pole-zero, recursive, or autoregressive moving average (ARMA) filter.

A filter in this form is easy to implement with the filter


function.

For example, a simple single-pole filter (low pass) is


b = 1; %Numerator a = [1 -0.9]; %Denominator where the vectors b and a represent the coefficients of a filter in transfer function form.

To apply this filter to your data, use


y = filter(b,a,x); %MATLAB function

Impulse Response
The impulse response of a digital filter is the output arising from the unit impulse input sequence defined as:

In MATLAB, you can generate an impulse sequence a number of ways; one straightforward way is imp = [1; zeros(49,1)];
The impulse response of the simple filter b = 1 and a = [1 -0.9] is h = filter(b,a,imp);

Filter Design and Implementation Filter design is the process of creating the filter coefficients to meet specific filtering requirements. Filter implementation involves choosing and

applying a particular filter structure to those


coefficients. Only after both design and implementation

have been performed can data be filtered.

Digital Filter Design Objective - Determination of a realizable transfer function G(z) approximating a given frequency response specification Digital filter design Digital filter design is the process of

deriving the transfer function G(z)


Two possibilities: IIR IIR or FIR FIR If an IIR filter is desired, G(z) should be a stable real rational function

Digital Filter Specifications

Usually, either the magnitude magnitude and/or the


phase phase (delay) response is specified for the design of a digital filter for most

applications
In some situations, the unit sample unit sample response response or the step response step response may be specified

Digital Filter Specifications


There are four basic types of ideal filters four basic types of ideal filters with magnitude responses as shown below

Digital Filter Specifications As the impulse response corresponding to each of these ideal filters is noncausal noncausal and of infinite length infinite length, these filters are not realizable In practice, the magnitude response

specifications of a digital filter in the


passband passband and in the stopband stopband are given with some acceptable tolerances acceptable tolerances In addition, a transition band transition band is specified between the passband and stopband

Digital Filter Specifications

For example, the magnitude response


of a digital lowpass filter may be given by indicated below

Selection of the Filter Type Selection of the Filter Type For FIR digital filter design FIR digital filter design, the FIR transfer function is a polynomial in Z-1 with real coefficients:

For reduced computational complexity computational complexity, degree N of H(z) must be as small as possible If a linear phase linear phase is desired, the filter coefficients must satisfy the constraint: h[n]=+-h[N-n]

Advantages in using an FIR filter


(1) Can be designed with exact linear phase linear phase, (2) Filter structure always stable always stable with quantized coefficients Disadvantages in using an FIR filter

Order Order of an FIR filter, in most cases, is


considerably higher than the order of an equivalent IIR filter meeting the same specifications, and FIR filter has thus higher computational complexity

Basic Approaches 1. Convert the digital filter specifications into an analog prototype analog prototype lowpass lowpass filter filter specifications 2. Determine the analog lowpass filter transfer function Ha(s ) meeting the specifications 3. Transform Ha(s ) into the desired digital transfer function G(z).

IIR Digital Filter Design: Basic Approaches

This approach has been widely used for


the following reasons: (1) Analog approximation techniques are

highly advanced
(2) They usually yield closed-form solutions (3) Extensive tables are available for analog filter design

(4) Many applications require digital


simulation of analog systems

IIR Digital Filter Design: Basic Approaches

An analog transfer function will be denoted


as Ha ( s ) =P a(s) / D a( s ) where the subscript a specifically indicates the analog domain A digital transfer function derived from shall be denoted as Ha(s ) G (z) = P (z ) / D( z )

IIR Digital Filter Design:


Basic Approaches Basic idea behind the conversion of Ha(s )

into G(z ) is to apply a mapping from the mapping from the


s-domain to the domain to the z-domain domain so that essential properties of the analog frequency response are preserved

Thus mapping function should be such that


Imaginary axis in the s-plane GGGG be mapped onto the unit circle of the z-plane

A stable analog transfer function be mapped into a stable digital transfer function

Filter Design Methods Butterworth (butter) Chebyshev Type I (cheby1) Chebyshev Type II (cheby2)

Elliptic (ellip)

IIR Digital Filter Design: Bilinear Transformation Method


Bilinear transformation in the s-plane to a unique point in the zplane and vice-versa given by

Above transformation maps a single point in the s-plane to a unique point in the z-plane and vice-versa
Relation between G(z) and is then Ha(s) is given by

Bilinear Transformation Mapping of s-plane into the z-plane

IIR Butter worth Low pass filter : MATLAB code used for the design [N, Wn] = buttord(.3249,1, 1,20,'s') [B, A] = butter(N,Wn,'s');

[num, den] = bilinear(B, A, 0.5);


freqz(num,den,256); ylim([-90 10]); xlabel('\omega/\pi'); ylabel('Gain, dB');

title('IIR Butterworth Lowpass Filter');

FIR Filter Design


Digital filters with finite-duration impulse response (all-zero, or FIR filters) have both advantages and disadvantages compared

to infinite-duration impulse response (IIR) filters.


Advantages: Can have exactly linear phase. Always stable. Design methods are generally linear.

Can be realized efficiently in hardware.


filter startup transients have finite duration.

Disadvantages: Require a much higher filter order than IIR filters to achieve a given level of performance.

FIR filter design methods Windowing Multiband with Transition Bands Constrained Least Squares

Raised Cosine

FIR Digital Filter Design:

Basic Approaches
Three commonly used approaches to FIR filter design:

(1) Frequency sampling approach


(2) Computer-based optimization methods (3) Windowed Fourier series approach

Gibbs Phenomenon Gibbs phenomenon Gibbs phenomenon - Oscillatory behavior in the magnitude responses of causal FIR filters obtained by truncating the impulse response coefficients of ideal filters

Gibbs Phenomenon
As can be seen, as the length of the lowpass filter is increased, the number of

ripples in both passband and stopband


increases, with a corresponding decrease in the ripple widths Height of the largest ripples remain the same independent of length

Similar oscillatory behavior observed in the


magnitude responses of the truncated versions of other types of ideal filters

Gibbs Phenomenon Gibbs Phenomenon


Rectangular window has an abrupt transition to zero outside the range M<=n<=M

, which results in Gibbs phenomenon in Ht(jG)


Gibbs phenomenon can be reduced either: (1) Using a window that tapers smoothly to zero at each end, or (2) Providing a smooth transition from passband to stopband in the magnitude specifications

FIR filter example

Design a 48th-order FIR bandpass filter with


passband :

b = fir1(48,[0.35 0.65]);
freqz(b,1,512)

You might also like