Design techniques

Published:

I. Introduction

Many design techniques for IIR discrete time filters have adopted ideas and terminology developed for analogue filters, and are implemented by transforming the transfer function of an analogue ‘prototype' filter into the system function of a discrete time filter with similar characteristics. In our project we require IIR filters (both Butterworth as well as Chebyshev Type I methods using bilinear transformation are tried to get the minimum order filter that meets the above mentioned specifications ). According to our problem the passband magnitude is constant to within 1dB for frequencies below 1000Hz, and stop-band attenuation is greater than 15dB for frequencies greater than 1500Hz. The sampling frequency, Fs, is 10000Hz.

II. Analogue Filters

Classical theory for analogue filters operating below about 100 MHz is generally based on "lumped parameter" resistors, capacitors, inductors and operational amplifiers ( with feedback ) which obey LTI differential equations:

Lady using a tablet
Lady using a tablet

Professional

Essay Writers

Lady Using Tablet

Get your grade
or your money back

using our Essay Writing Service!

Essay Writing Service

[ i(t) = C dv(t) / dt, v(t) = L di(t) / dt, v(t) = i(t)R, v 0 (t) = A v i(t) ].

Analysis of such LTI circuits gives a relationship between input x(t) and output y(t) in the form of a differential equation:

whose system (or transfer) function is of the form:

This is a ratio of polynomials in s . The order of the system function is max(N,M). Replacing s by jw gives the frequency-response H a (jw), where w denotes frequency in radians/second. For values of s with non-negative real parts, H a (s) is the Laplace Transform of the analogue filter's impulse response ha(t). H(s) may be expressed in terms of its poles and zeros as:

There is a wide variety of techniques for deriving H a(s) to have a specified type of frequency response. For example, it may be shown that a general expression for the system function of an n th order analogue Butterworth low-pass filter, with gain response:

III. First Order Filters

Consider the first order analogue low-pass filter below with input and output voltages x(t) and y(t) respectively:-

Since the current in R is equal to the current in C it follows that:

Therefore the differential equation for this circuit is:

The system function is:

The gain response is :

where w c = 1 / (RC) . This is the gain response of a first order Butterworth low-pass filter with cut-off frequency w c .

IV. Butterworth & Chebyshev Filters

This is the most common method for transforming the system function Ha (s) of an analogue filter to the system function H(z) of an IIR discrete time filter. It is not the only possible transformation, but a very useful and reliable one.

V. Comparison Filters, Structures & Graphs

VI. Program in Matlab

Main Program: Include 3 functions and 2 structures for the filters (see also m.files in my cd)

function [atp,ats] = attenuation(H, wp ,ws)

% Actual attenuation for IIR low-pass filters.

% [atp,ats] = attenuation(H,wp,ws) returns the actual passband attenuation

% in dB (atp) and actual stopband attenuation in dB (ats) for IIR lowpass

% filter with frequency response H, passband cut-off frequency wp and

% stopband cut-off frequency ws.

ABSH = abs(H);

wpidx = floor((length(H) - 1) * wp / pi + 1);

Pass_ABSH = ABSH(1:wpidx);

atp = 20 * log10(max(Pass_ABSH)) - 20 * log10(min(Pass_ABSH));

wsidx = ceil((length(H) - 1) * ws / pi + 1);

Stop_ABSH = ABSH(wsidx:length(ABSH));

ats = -20 * log10(max(Stop_ABSH));

=====================================================================================

function my_IIRl(w, wp ,ws, dp, ds)

% my_IIRl (Myf_Plot_IIR_LP_Boundaries)

% my_IIRl (w,wp,ws,dp,ds)

% Plot boundaries for IIR low-pass filter.

awpTop = w(1:min(find(w>ws)));

plot(awpTop, (1)*ones(size(awpTop)),'r--');

awpBottom = w(1:min(find(w>wp)));

plot(awpBottom, (1-2*dp)*ones(size(awpBottom)),'r--');

aws = w(min(find(w>ws)):length(w));

plot(aws, ds*ones(size(aws)),'r--');

plot([wp wp],[0 1-2*dp],'r--');

plot([ws ws],[ds 1],'r--');

=====================================================================================

function my_IIRlB(w, wp, ws, Atp_dB, Ats_dB, Log10AxisBottom)

Lady using a tablet
Lady using a tablet

Comprehensive

Writing Services

Lady Using Tablet

Plagiarism-free
Always on Time

Marked to Standard

Order Now

% my_IIRlB (Myf_Plot_IIR_LP_Boundaries_dB)

% my_IIRlB(w,wp,ws,dp,ds)

% Plot log10 boundaries for IIR low-pass filter.

awpTop = w(1:min(find(w>ws)));

plot(awpTop, zeros(size(awpTop)),'r--');

awpBottom = w(1:min(find(w>wp)));

plot(awpBottom, (-Atp_dB)*ones(size(awpBottom)),'r--');

aws = w(min(find(w>ws)):length(w));

plot(aws, -Ats_dB*ones(size(aws)),'r--');

plot([wp wp],[Log10AxisBottom -Atp_dB],'r--');

plot([ws ws],[-Ats_dB 0],'r--');

=====================================================================================

% DSP course

% IIR Low filter using Chebyshev I

% Bilinear transformation

% F : Analog frequency in Hertz.

% W : Analog frequency in radians per second.

% w : Digital frequency in radians per sample.

% f : Digital frequency in Hertz.

clear all; close all; clc;

% Specifications

% Sampling frequency (Hz)

Fs = 10000;

% Pass-band cut-off frequency (Hz)

Fpassband = 1000;

% Stop-band frequency (Hz)

Fstopband = 1500;

% Pass-band attenuation (dB)

Atp_dB = 1;

% Stop-band attenuation (dB)

Ats_dB = 15;

do_plots = 1; % 0 or 1

% Find digital domain specifications

Wp = 2 * pi * Fpassband;

Ws = 2 * pi * Fstopband;

Ts = 1 / Fs; % Sampling period

wp = Ts * Wp;

ws = Ts * Ws;

%Atten. P. = 20 * log10 (1 + dp) - 20 * log10 (1 - dp)

dp = (10^(Atp_dB/20)-1)/(10^(Atp_dB/20)+1);

ds = 10^(-Ats_dB / 20); % Atten. S. = 20 * log10 (ds)

% Compute

% Find normalized passband and stopband frequencies

wp_n = Fpassband/(Fs/2); ws_n = Fstopband/(Fs/2);

plot_analog_filter = 0; % Will be set to 1 when it is available

[n,wc_n] = cheb1ord(wp_n,ws_n,Atp_dB,Ats_dB);

[b1,a1] = cheby1(n,Atp_dB,wc_n,'low');

% NOTE for Butterworth low pass filter just replace the previous two commands with the following:

% NOTE [n,wc_n] = buttord(wp_n,ws_n,Atp_dB,Ats_dB);

% NOTE [b1,a1] = butter(n,wc_n,'low');

% NOTE for high pass filters just replace the low with the high

Freqzfs = 256;

[H1,w] = freqz(b1,a1,Freqzfs);

% Display the results

Str01 = sprintf ('Filter type: %s');

Str02 = sprintf ('Order of filter: %d', n);

[Actual_Atp_dB, Actual_Ats_dB] = attenuation (H1, wp, ws);

Str03 = sprintf ('Actual passband attenuation: %f', Actual_Atp_dB);

Str04 = sprintf ('Actual stopband attenuation: %f', Actual_Ats_dB);

sprintf ('%s\n%s\n%s\n%s', Str01, Str02, Str03, Str04)

ProblemStr = sprintf ('n=%d', n);

if do_plots

figB = 200; figL = 100; figW= 430; figH = 340;

% Magnitude response plot

figure('position', [figB figL figW figH])

hold on

my_IIRl(w, wp, ws, dp, ds); % Plot boundaries

plot(w,abs(H1))

xlabel('Frequency \omega (rad/sec) ---\rightarrow');

ylabel('Magnitude |H(\omega)| ---\rightarrow');

title(sprintf('Magnitude response, %s', ProblemStr));

axis([0 pi 0 1+dp]);

% Phase response plot

figure('position', [figB figL figW figH])

plot(w,unwrap(angle(H1)));

xlabel('Frequency \omega (rad/sec) ---\rightarrow');

ylabel('Phase arg H(\omega) (rad) ---\rightarrow');

title(sprintf('Phase response, %s', ProblemStr));

% Log10 magnitude response plot

figure('position', [figB figL figW figH])

hold on

Log10AxisBottom = -Ats_dB - 10;

my_IIRlB(w,wp,ws,Atp_dB,Ats_dB, Log10AxisBottom); % Plot boundaries

plot(w,20*log10(abs(H1)))

xlabel('Frequency \omega (rad/sec) ---\rightarrow');

ylabel('Magnitude 20*log10|Hh(\omega)| (dB) ---\rightarrow');

title(sprintf('Log10 magnitude response, %s', ProblemStr));

axis([0 pi Log10AxisBottom 1]);

% Log10 magnitude response plot, whole

figure('position', [figB figL figW figH])

hold on

H1dB = 20*log10(abs(H1));

plot(w, H1dB)

axis ([0 pi min(H1dB) max(H1dB)])

grid

xlabel('Frequency \omega (rad/sec) ---\rightarrow');

ylabel('Magnitude 20*log10|Hh(\omega)| (dB) ---\rightarrow');

title(sprintf('Log10 magnitude response, %s', ProblemStr));

if plot_analog_filter

% Plot magnitude response of analog filter

% filter will not meet the boundaries.

figure('position', [figB figL figW figH])

hold on

Aw = linspace(.001,Fs,Freqzfs)*2*pi; % .001 used instead of zero

AH = freqs(ba,aa,Aw);

my_IIRl(Aw, Wp, Ws, dp, ds);

Lady using a tablet
Lady using a tablet

This Essay is

a Student's Work

Lady Using Tablet

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Examples of our work

plot(Aw,abs(AH));

axis([min(Aw) max(Aw) 0 1+dp]);

xlabel('Frequency \omega (rad/sec) ---\rightarrow');

ylabel('Magnitude |H(\Omega)| ---\rightarrow');

title(sprintf('Prototype analog filter, %s', ProblemStr));

end

end