digital filters - uvic.cadsp/help/usersguide.pdf · mation method for the design of recursive...

71
FILTERS DIGITAL ANDREAS ANTONIOU ANALYSIS, DESIGN, AND SIGNAL PROCESSING APPLICATIONS

Upload: others

Post on 28-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • FILTERSDIGITAL

    ANDREASANTONIOU

    ANALYSIS, DESIGN, AND SIGNAL PROCESSING APPLICATIONS

  • USER’S GUIDE FOR D-FILTER

    (Revision Date: 31 Jul, 2018)

    Copyright c© 2018 Andreas Antoniou

  • User’s Guide for D-Filter 3

    SUMMARY

    D-Filter is a Windows-based DSP software package that can be used toanalyze, design, and realize digital filters, and also to analyze discrete-time signals. The program can analyze recursive (IIR) and nonrecursive(FIR) filters in the time and frequency domains. It implements mostof the classical design methods such as the Fourier series and Remezmethods for the design of nonrecursive filters and the bilinear transfor-mation method for the design of recursive filters, and it can obtain thestandard realizations such as the cascade and parallel direct canonic,state-space, and wave lattice realizations. The software also includesfunctions that can be used to obtain zero-pole plots for digital filters orto study the effects of coefficient quantization. D-Filter entails a mod-ular top-down architecture, includes a good graphical user interface,and saves data in terms of certain standard data structures at everystep of the design process. In consequence, specific processes can berepeated and checked any number of times until the D-Filter user ishappy with the results. The software would enable students to interac-tively learn the fundamentals of DSP and digital-filter design and it canalso be used by DSP practitioners and scientists to carry out designsfor real-life applications or for research purposes.

  • User’s Guide for D-Filter 4

    1. INTRODUCTION

    D-Filter is a Windows-based DSP software package for the analysis and design of digitalfilters and discrete-time signals. The software originally comprised a collection of individualUNIX programs that were written by the author to develop his books on digital filters [1]–[3]and also to facilitate his research in the areas of analog and digital filters, optimization, anddigital signal processing but in later years the individual programs were integrated into acohesive application with considerable help from his graduate students Nelson Ko and DavidGuindon. D-Filter has been used in the past to support Digital Signal Processing, Signals,Systems, and Filters [4] and it can also be used as a learning tool in support of the author’slatest edition Digital Filters, Analysis, Design, and Signal Processing Applications [5]. Theoriginal goal was to develop a software package that would enable students to interactivelylearn the fundamentals of DSP and digital-filter design but it can also be used by engineersand scientists to design digital filters and analyze discrete-time signals.

    D-Filter implements many of the techniques, methods, and algorithms found in the au-thor’s textbooks on the subject in a highly modular architecture and it is, therefore, flexibleand easy to use. The modules of D-Filter are menu driven and interact among themselvesthrough a common data environment which will be referred to hereafter as the D-Filter databank. Alternatively, they can interact through a collection of standard unformatted textfiles that are entirely accessible to the user through the use of any one of the standard texteditors (e.g., Notepad). The output of D-Filter, e.g., graphs and numerical design data andparameters, is made available to the user through a graphical user interface and throughformatted text files. Complicated design procedures are broken down into individual stepsthat facilitate the user to plot and view the results achieved at the end of each step of thedesign.

    Technology has moved a long way since the original design of D-Filter and it would berather difficult to add new options and features to D-Filter without a small team of softwaredevelopers. While writing his most recent edition [5], the author developed a good collectionof software for the analysis, design, and applications of digital filters that are implementedmostly in MATLAB and plans to make them available in the near future see

    http://www.ece.uvic.ca/∼dsp/Software-ne

    To facilitate the exposition of the User Guide, the components of D-Filter are color codedas follows:

    • Button

    • Dialog box

    • Help description

    • Pull-down menu

    • Module

    http://www.ece.uvic.ca/~dsp/Software-ne

  • User’s Guide for D-Filter 5

    • Option

    • Check box

    • Selection

    2. D-FILTER STRUCTURE

    D-Filter is organized in terms of a top-down architecture whereby its functions, modules,and utilities are laid out under six main pull-down menus labelled File, Analysis, Design,Realization, View and Help. Analysis, Design, and Realization serve as the main function-ality pull-down menus while File, View, and Help provide standard Windows functions likeopening files, activating the toolbar, or providing help descriptions on the use of the variousmodules. When needed, D-Filter spawns additional pull-down menus, for example, File isexpanded into File, Edit, and Character if a text file is opened (see Sec. 3. FILE) and Help isexpanded into Help, Color Options, and Preferences if the graphical user interface of D-Filteris activated (see Sec. 8.1 Graphical Output).

    The three main functionality pull-down menus, i.e., Analysis, Design, and Realization,lead to new nested pull-down menus which may, in turn, lead to new nested pull-downmenus. Each series of pull-down menus leads to a dialog box which facilitates the entry ofinput data. Additional dialog boxes may pop-up as needed to supply data to the D-Filterfunctions. When needed the D-Filter functions save output as well as input data in textfiles and sometimes cause the graphical interface to spawn windows that display graphs.For example, to find the amplitude response of a nonrecursive filter of the general type,one would need to select Analysis, followed by Frequency Domain, followed by NonrecursiveFilter, followed by General, as depicted in Fig. 1a. This selection can be represented inshorthand form as

    Analysis > Frequency Domain > Nonrecursive Filter > General

    It will spawn a dialog box Select filter which will enable the user to select one of thefour options available, namely, Stored filter, Filter on file, Change Stored filter, and Newfilter. Option Stored filter will cause a filter in D-Filter’s data bank that has been designedby another D-Filter module during the current session; Filter on file will cause D-Filter toread the input data from a text data file accessible to D-Filter; Change Stored filter enablesD-Filter to change the data in a filter stored in the data bank; and New filter will spawn adialog box that will enable the user to enter the required input data manually through thekeyboard. See Sec. 7. Input Data for more information.

    When the required input is supplied, a new dialog box will be spawned that provides theavailable options, namely,

    • Gain > Log

    • Gain > Linear

  • User’s Guide for D-Filter 6

    • Phase

    • Group Delay

    Options Gain > Log or Gain > Linear, Phase, and Group Delay will cause D-Filter tocomputer the amplitude response with the gain in dB or as a ratio, the phase response, andthe group delay, respectively.

    Clicking button Next will cause another dialog box Frequency Range to be spawnedthat will enable the user to supply the sampling frequency, initial frequency, final frequency,number of points, and minimum gain in dB which is used to limit the minimum gain toassure a well proportioned plot. One can also enabe or disable the Save output file option.This will cause the Save Formatted Output File dialog box to pop up which enables the userto supply the name of the preferred file name. A default file name, “untitled”, is providedwhich is expanded by D-Filter to “untitled.txt”. If there is a file with the name “untitled.txt”in the D-Filter Home folder, it will be overwritten without warning by design. To preservean output .txt file, the user would need to use a customized file name which prevents the filefrom being overwritten. The default name “untitled.txt” should probably be chosen mostof the time to prevent D-Filter from overcrowding the D-Filter working folder with output.txt files.

    When the analysis is done, D-Filter produces a window that displays the desired compo-nent of the frequency response, namely, the amplitude response.

    The pull-down menus for Design and Realization are illustrated in Fig. 1b and c.

  • User’s Guide for D-Filter 7

    (a)

    (b)

    Figure 1 Structure of pull-down menus: (a) Analysis, (b) Design.

    (c)

    Figure 1 Cont’d Structure of pull-down menus: (c) Realization.

  • User’s Guide for D-Filter 8

    2.1 Analysis

    Several types of analysis can be carried out with D-Filter. Frequency-domain analysis isavailable for analog, recursive, and nonrecursive filters, as can be seen in Table 1.

    Table 1 Analysis Pull-Down Menu

    AnalysisCoefficient QuantizationDiscrete Fourier TransformFrequency Domain

    Analog/Recursive FilterNonrecursive Filter

    GeneralLinear Phase

    Roundoff NoiseTime DomainZero-Pole Plot

    Partial FractionsRoots of PolynomialsScaling

    Sequence

    Analysis > Frequency Domain > Analog/Recursive

    can be used to obtain frequency responses for cascade or parallel analog or recursive digitalfilters. Linear and logarithmic amplitude responses, phase responses, and delay characteris-tics can be computed and graphed, and repeated runs can be carried out over any desiredfrequency range using any desired number of sample points.

    Sequence

    Analysis > Time Domain

    can be used to obtain impulse, unit-step, sinusoidal responses as well as responses to arbitrarycustomized input waveforms.

    Sequence

    Analysis > Discrete Fourier Transform

  • User’s Guide for D-Filter 9

    which employs a state-of-the art fast Fourier transform, can be used to obtain amplitudeand phase spectrums of discrete-time signals.

    Under Analysis, D-Filter also provides some mathematical tools that are frequentlyneeded in the analysis and design of digital filters. Module Partial Fractions can expressa given transfer function as a sum of partial fractions or convert it from the product to thesum form (see Sec. 12.2, Exercise 2).

    There are, in addition, facilities to find the roots of polynomials and construct zero-poleplots for discrete-time systems and to apply scaling to digital-filter structures using either afrequency- or a time-domain method.

    2.2 Design

    The modules under the Design pull-down menu can be used to obtain continuous-time trans-fer functions for analog filters or to design nonrecursive and recursive digital filters as wellas some specialized discrete-time systems such as digital differentiators and Hilbert trans-formers. The options available are listed in Table 2.

    Under the first option, various types of nonrecursive filters can be designed with theWindow or Remez method.

    The second option provides design techniques for recursive filters. The first module ofthis option is Analog Approximations. It computes the coefficients as well as the zerosand poles of continuous-time transfer functions for normalized lowpass Bessel, Butterworth,Chebyshev, inverse-Chebyshev, and elliptic filters.

    Module Analog Transformations can convert a normalized continuous-time lowpass trans-fer function into a corresponding denormalized transfer function of one of the standard types,i.e., lowpass, highpass, bandpass, or bandstop.

    Module Bilinear Transformation can be used to convert a continuous-time transfer func-tion into a corresponding discrete-time transfer function which would represent a recursivedigital filter.

    The modules under Prescribed Specifications can be used to design filters that wouldsatisfy arbitrary prescribed specifications.

    Other types of digital-filter designs can be obtained by using one of the invariant time-domain response methods or the matched-z transformation approach by selecting the appro-priate modules under Design. These modules always yield a realizable and stable discrete-time transfer function.

  • User’s Guide for D-Filter 10

    Table 2 Design Pull-Down Menu

    DesignNonrecursive

    FiltersRemez MethodWindow Method

    Fixed LengthPrescribed Specifications

    Digital DifferentiatorsNumerical MethodRemez MethodWindow Method

    Hilbert TransformersWindow Method

    RecursiveAnalog ApproximationsAnalog TransformationsBilinear TransformationInvariant Time-Domain ResponseMatched-z TransformationPrescribed Specifications

    Bilinear Transformation DesignInvariant Time-Domain Response DesignMatched-z Transformation Design

    Partial Fractions

    2.3 Realization

    D-Filter can be used to obtain direct canonic, lattice, state-space, or wave lattice realizations,as depicted in Table 3. In the first four forms, the input is a discrete-time transfer function inproduct or sum form and the structure produced is either cascade or parallel. For the wavelattice realization, a continuous-time transfer function in product form is required. Thispull-down menu also links to module Partial Fractions which is often required to convert atransfer function from the product to the sum form (see Sec. 11.3).

  • User’s Guide for D-Filter 11

    Table 3 Realization Pull-Down Menu

    RealizationCascade or Parallel DirectCascade or Parallel CanonicCascade or Parallel LatticeState SpaceWave Lattice

    Partial Fractions

    3. FILE

    Pull-down menu File provides standard Windows functions such as creating, opening, orprinting a file. When a text file is opened, D-Filter expands File into three pull-downmenus, namely, File, Edit, and Character. Menu Edit facilitates cutting, copying, pasting,or deleting text whereas menu Character enables the user to replace the font family or pointsize in an open text file, or to activate or cancel word wrap. Note that

    1. font change can be applied to an open text file and cannot be used to change thedefault font of D-Filter, which is always fixed to a font of the courier family,

    2. option Left which stands for left alignment is always preselected, and

    3. options Right and Center which would stand for right or center alignment in certainapplications have not been implemented in D-Filter and, consequently, cannot be se-lected.

    4. VIEW

    Under View, the user can choose to display the Toolbar or Status Bar or select the arrange-ment of windows in the home window, e.g., vertical, horizontal, or cascade.

    5. HELP

    Under Help, a description of the available functions and modules as well as other usefulinformation can be found. By clicking on an item in the Table of Contents, the user can

  • User’s Guide for D-Filter 12

    obtain information about the functionality of the chosen module and how to use it, the typeof input required, the type of output that would be produced, the structure of unformatteddata files, and other useful hints.

    6. TOOLBAR

    The toolbar whose functionality is illustrated in Fig. 2 provides quick access to frequentlyused functions. For example, clicking button TR or FR will initiate a time-domain or afrequency-domain analysis of a new or stored digital or analog filter while button DFT willinitiate a discrete Fourier transform analysis of new or stored discrete-time signals. Thetoolbar provides other facilities as well, such as selecting the desired arrangement of childwindows, clearing any open windows, accessing the Help module, and resetting the softwareto its starting state. The reset operation is activated by clicking the eraser icon but the useris well advised to exercise caution in the use of the eraser because in addition to resetting thedefault initial values of the software it also clears the D-Filter data bank. More informationabout the Toolbar can be found in the Application Layout description under Help.

    Figure 2 Toolbar.

    7. INPUT DATA

    Input data can be supplied to a module in three different ways, as follows:

    • By entering the data manually through the keyboard.

    • By reading the data from an unformatted data file.

    • By retrieving the data from the D-Filter data bank.

    The different modes of inputting data are illustrated in Fig. 3. D-Filter prompts the user tochose the mode of data entry before the activation of the module through one or more pop-updialog boxes. The number of input options available depends on the type of the required

  • User’s Guide for D-Filter 13

    D-Filter action. In analysis tasks, three to four options are provided. For example, modulesthat perform frequency-domain analysis of filters provide four input options, as follows:

    UnformattedData File

    UnformattedData File

    Manual

    Entry

    Formatted

    Output File

    D-Filter

    Data Bank

    Graphical

    InterfaceModule

    Figure 3 Input and output data for modules.

    • Stored filter

    • Filter on file

    • Change stored filter

    • New filter

    When a module designs a filter, the data produced by the module is in the form of awell-defined data structure which is stored in the D-Filter data bank and saved by defaultin an unformatted data file whose name can be chosen by the user. In this way, the filterdata can be accessed by other modules for further processing. The data in the D-Filterdata bank is temporary and it is immediately overwritten if another design is carried outthat produces the same data structure whereas the data in an unformatted data file can beretained indefinitely by selecting a unique name for the data file. For example, if a filterthat has just been designed is to be analyzed using the frequency-domain analysis module,the user can select input option Stored filter or Filter on file to direct D-Filter to retrievethe filter data from the D-Filter data bank in the first case or to read the data from theunformatted data file produced by the design module in the second case. Option Changestored filter enables the user to change the filter data currently stored in the D-Filter databank. This option would enable a designer to investigate the effects of changes in one ormore filter coefficients, for example. Option New filter enables the user to enter the filterdata manually through the keyboard in a pop-up dialog box. This option might be neededonce in a blue moon to check a digital filter that was not designed by D-Filter since D-Filter’sdesigns are normally readily available in the D-Filter data bank or in an unformatted datafile or can be easily generated.

  • User’s Guide for D-Filter 14

    D-Filter uses a number of standard unformatted data files which are readable text filesthat comprise letters, fixed-point numbers, and floating-point numbers. Data are entered inthese files sequentially in a number of lines, without explanation, in an order that can beeasily read by a computer program. Unformatted data files could be constructed by using anyone of the usual text editors but the user would need to know the structure of the requiredfile. This is detailed in the Help description of the module of interest but manual data entryin the few circumstances where it might be needed can be more easily done through the useof the New filter option.

    Different modules need different types of input and, consequently, D-Filter uses varioustypes of unformatted data files which are distinguished by unique 3-letter extensions such as.coe and .zps. D-Filter provides default names to unformatted data files such as untitled.coeand untitled.zps but the user can choose to overwrite the default file name by any othername that appears to be appropriate for the application at hand and is consistent with theWindows system. See Help description Unformatted Data Files for more information.

    8. OUTPUT DATA

    D-Filter writes the output data it produces in formatted output text files and, where ap-plicable, it displays the results obtained in graphical form in terms of graphs and plots.The default file name for formatted output text files is untitled.txt but, as for unformatteddata files, the user can choose to overwrite the default file name by any other name thatis consistent with the Windows system. See Formatted Data Files under Help for moreinformation.

    The use of default file names untitled.coe, untitled.zps, untitled.txt, etc., implies thatinput and output data files are continuously overwritten by new input and output data filesand, as a consequence, once in a while useful data might be overwritten by accident. However,there is a great benefit as well in using these default file names: D-Filters Home folder willnot become overcrowded by numerous old input and output data files. The practical solutionto this problem is to accept the default file names until the desired analysis or design resultshave been achieved, and after that repeat the analysis or design one last time with user-defined file names for the input and output data files. Recall that any attempt to overwritea user-defined file name will produce a warning.

    8.1 Graphical Output

    Several types of plots can be produced by D-Filter, for example,

    • time-response plots• amplitude-response plots• phase-response plots

  • User’s Guide for D-Filter 15

    • delay characteristics• zero-pole plots• amplitude spectrum plots• phase spectrum plots

    Module Time Response will produce plots of the time-domain response of a digital filterto a specified input such as an impulse, a unit-step, or a sinusoid. Module FrequencyResponse can be used to obtain plots of the amplitude and phase responses as well asthe delay characteristic of analog or digital filters. Zero-pole plots are produced by manydesign modules whose output is in the form of a new transfer function either in terms ofits coefficients or its zeros and poles. Amplitude and phase spectrums are produced by thediscrete Fourier transform.

    When the graphical interface is active, i.e., when one or more windows are spawned in theform of graphs or plots, three new pull-down menus become available to the right of the Helpmenu, namely, Color Options, Preferences, and Axes Limits which would facilitate the userto customize the graphing functions. Through the Color Options menu, the user can choosethe color of the background, curve, grid, and other graph elements. Under Preferences, onecan zoom in or zoom out, or enable the cross cursor. Using the Axes Limits menu, one canchange the lower and upper limits of the bottom or left axes to obtain a more pleasing graph.A shortcut to this facility is to simply click on the bottom or left axis and then enter thedesired limits in the pop-up dialog box.

    Note that whenever the parameters of the customization are changed, they usually over-write the previous set and become the new default parameters.

    8.2 Printing

    The user may need to print a formatted output text file, such as output.txt, or a graph.A formatted text file can be printed by associating it with a standard text editor such asNotepad or WordPad and then clicking Print under File as is usually done in Windowsapplications. To print a graph, it is first necessary to save the graph in a document of someform to start with. To save one or more graphs displayed, proceed as follows:

    1. Using pull-down menu Color Options in D-Filter, customize the spawned window toobtain the desired colors for the various elements of the graphs. (If a black-and-whiteprinter is to be used, select black-on-white or white-on-black color options.)

    2. To save one or more graphs in a Word document, start a Word document. Then selectSave as Word under File. Alternatively, one can save a graph using the Clipboard asdetailed in item (3) below. Once saved in a Word document, the graphs can be scaledor moved in the usual way.

    3. To save graphs in a Word, WordPad, Adobe Illustrator, or Adobe Photoshop documentdo the following:

    • Start a new document with one of the aforementioned applications.

  • User’s Guide for D-Filter 16

    • Select the first graph of interest.• Select Copy to Clipboard under File.• Go to the opened document and select Paste under Edit.• Repeat the above procedure for each D-Filter graph that needs to be saved.

    4. To obtain a PDF file for a graph, save the graph in a Word document as detailed aboveand then choose option Print to file using Adobe PDF as printer.Another way is to save the graph in a Word document as detailed above, and then chooseoption Print to file using any PostScript printer. After that convert the PostScript to aPDF file by running the Adobe Acrobat.Yet another way would be to paste the graph in an Adobe Illustrator or Photoshopdocument and then save the document using Save As with the PDF file format.

    5. To obtain an EPS file for a graph, paste the graph in an Adobe Illustrator or Photoshopdocument and then save the document using Save As with the EPS file format.

    If for some reason the entire D-Filter window along with the borders, menu bar, andtoolbar needs to be saved and printed as in Fig. 1a to c, proceed as follows:

    1. Maximize both the graph and D-filter windows.2. Press key Print Screen on the keyboard.3. Restore the D-Filter window.4. Open a WordPad, Word, Illustrator, or Photoshop document and select Paste under

    Edit.

    Once one or more graphs have been saved in a document using one of the aforementionedsoftware, a hard copy can be readily printed in the usual way.

    9. COMMUNICATION AMONG MODULES

    The various modules communicate with each other through the D-Filter data bank as wellas through unformatted data files. Certain standardized well-defined file structures are usedfor the unformatted data files to ensure that a data file of a given type can be read by allmodules that might need this particular type of data as input, and to ensure that a datafile produced as output by one module can be read as input by another module. Groups ofmodules interact with one another through the architecture illustrated in Fig. 4 where thetwo-way arrows designate two-way data flows. In this arrangement, the output of Module1 is saved in the D-filter data bank as well as an unformatted data file and can be used asinput for Module 2. After processing, the output of Module 2 is saved in the D-Filter databank as an unformatted file, and can then be used as input for Module 3, and so on. In thisway, successive processing steps can be carried out one after another without the need formanual intervention.

    D-Filter is also programmed to produce unformatted data files in situations where inputdata are entered manually through the keyboard, for example, when option New filter orCustomized input is chosen. This is done to enable the user to carry out future tests with thesame input data without the need for manual data entry which is ever so time-consuming.

  • User’s Guide for D-Filter 17

    Manual Entry Manual Entry

    Manual Entry Manual Entry

    Unformatted Data Filesor

    D-Filter Data Bank

    Module 1 Module 2

    Module 3 Module 4

    Figure 4 Data flow between modules.

    10. RUNNING D-FILTER

    A user can start D-Filter in any one of the usual Windows methods, e.g., by clicking theD-Filter icon on the Desktop or through the “Start” menu. Upon installation, D-Filter willtreat folder “Projects” in its installation folder , typically, C:\Program Files (x86)\D-Filter,as its Home folder . However, the default “Home” folder can be changed to any other folderby simply opening a file or by saving data in the desired folder. D-filter will retain the newfolder as the new default Home folder until the user opens a file or saves data in yet anotherfolder which will automatically become the new default Home folder, and so on.

    The typical usage of D-Filter is to run one or more of its modules through pull-downmenus. A module is selected through a series of nested pull-down menus which usually lead

  • User’s Guide for D-Filter 18

    to a series of pop-up dialog boxes that enable the user to supply the required input data,options of interest, and the desired output. Once the input data is available to the module,it will request information about the required type of output and where to save it.

    To facilitate exposition, the user actions needed to activate and use a module of D-Filterto achieve a specific design or analysis goal can be described in shorthand notation in termsof a sequence of actions such as

    • select a pull-down menu

    • choose a particular entry of a pop-up dialog box

    • specify an unformatted input data file

    • choose a module option

    • enter a set of numbers

    • select the type of plot required

    • specify a formatted output file

    separated by the “greater than” symbol “>” as was done in Sec. 2. D-Filter Structure..For example, a sequence of actions like the one that follows, which will be referred to as aselection hereafter:

    Analysis > Frequency Domain > Analog/Recursive Filters > Filter on file> elliptic.coe > Log > Enter data > Next > output.txt

    can be interpreted as follows:

    • Select pull-down menu Analysis.

    • Select nested pull-down menu Frequency domain.

    • Select module Analog/Recursive filter.

    • Specify unformatted data file as the source of the input.

    • Select input file elliptic.coe

    • Obtain the amplitude response using logarithmic scale in dB for the gain.

    • Enter data in the pop-up dialog box.

    • Plot the amplitude response.

    • Specify formatted file output.txt as the output data file.

  • User’s Guide for D-Filter 19

    After the above actions, the user can obtain any number of amplitude and/or phaseresponses and/or delay characteristics, one after the other, for arbitrary frequency rangesand arbitrary numbers of sample points by clicking the frequency response (FR) button onthe toolbar.

    The above short-hand notation is used extensively in the tutorial exercises that follow aswell as in the module descriptions found under Help to explain the operation of the modules.

    11. CHARACTERIZATION OF DIGITAL FILTERS

    There are several mathematical ways of representing or characterizing a discrete-time systemor digital filter, e.g., by a difference equation, by a transfer function in product or sum form,or by a state-space matrix representation. See [4, 5] for the background theory for this andsubsequent sections.

    11.1 Difference Equation

    An Nth-order recursive digital filter, also known as infinite-duration impulse response (IIR)digital filter, can be represented by a difference equation of the form

    y(nT ) =N∑i=0

    aN−ix(nT − iT )−N∑i=1

    bN−iy(nT − iT ) (1a)

    If the coefficients bN−i for i = 1, 2, . . . , N are all zero, we obtain the simplified differenceequation

    y(nT ) =N∑i=0

    aN−ix(nT − iT ) (1b)

    which represents an Nth-order nonrecursive filter, also known as finite-duration impulseresponse (FIR) digital filter.

    11.2 Transfer Function

    By applying the z transform to the difference equation of a discrete-time system, the discrete-time transfer function can be obtained, which can be expressed in one of the following forms

  • User’s Guide for D-Filter 20

    Y (z)

    X(z)= H(z) =

    ∑Ni=0 aN−iz

    −i

    1 +∑N

    i=1 bN−iz−i

    (2a)

    =

    ∑Ni=0 aN−iz

    N−i

    zN +∑N

    i=1 bN−izN−i

    (2b)

    =

    ∑Ni=0 aiz

    i∑Ni=0 biz

    i(2c)

    = H0

    ∑Ni=0 ai

    ′zi∑Ni=0 biz

    i(2d)

    where H0 is a multiplier constant. We note that a digital filter is fully specified by thecoefficients of the difference equation or, equivalently, by the coefficients of the transferfunction and constant H0.

    11.3 Cascade and Parallel Structures

    D-Filter assumes a digital filter to be a cascade or parallel arrangement of filter sections ofarbitrary orders as depicted in Fig. 5a and b. In the cascade structure, the transfer functionis in the product form

    H(z) = H0

    K∏j=1

    Hj(z) (3)

    whereas in the parallel structure it assumes the sum form

    H(z) = H0

    (K∑j=1

    Hj(z)

    )(4)

    where

    Hj(z) =K∑j=1

    a0j + a1jz + · · ·+ aMjzMjb0j + b1jz + · · ·+ bNjzNj

    In the above equations, K is the number of filter sections, and Mj and Nj are thenumerator and denominator orders of the jth filter section, respectively. A transfer functioncan be stored in terms of its coefficients in unformatted data files carrying the file extension.coe, e.g., input.coe, output.coe, filename.coe.

    Alternatively, a discrete-time transfer function can be described in terms of its zeros andpoles as

    H(z) = H0

    ∏Mi=1(z − zi)∏Ni=1(z − pi)

    (5)

  • User’s Guide for D-Filter 21

    H0

    H1(z)

    HK

    (z)

    H2(z)

    H1(z)

    HK

    (z)

    H2(z)

    H0

    (a) (b)

    Figure 5 (a) Cascade structure. (b) Parallel structure.

    where H0 is a multiplier constant as before, zi is the ith zero, pi is the ith pole, M is thenumber of zeros, and N is the number of poles. A transfer function is stored in terms of itszeros and poles in unformatted data files carrying the extension .zps, e.g., filename.zps.

    Yet another form of the transfer function, which is sometimes used by D-Filter, is interms of its residues and poles, namely,

    H(z) = K0 +N∑i=1

    Riz − pi

    (6)

    In this case, K0 is a constant, Ri is the residue of pole pi, and N is the order of the transferfunction, which happens to be the same as the number of poles. Data files containing atransfer function in term of its residues and poles carry the extension .rsd, e.g., filename.rsd.

    A transfer function specified as a product of first- and second-order transfer functionseither in terms of its coefficients as in Eq. (2) or in terms of its zeros and poles as in Eq. (5)can be readily converted into the residue form of Eq. (6) by running module Partial Fractions.

    D-Filter strongly prefers transfer functions in the product or the sum forms of Eqs. (3)and (4) and, therefore, the transfer function in Eq. (6) is often expressed in the standard sumform of Eq. (4). This is done by pairing partial fractions with complex conjugate coefficientsand then performing some straightforward algebra. For digital filters whose transfer-functioncoefficients are real, which is the underlying assumption for D-Filter, the poles of the transferfunction normally occur in complex conjugate pairs but there is at least one real pole in thecase where the order of the transfer function N is odd. It can be shown that the residues atcomplex conjugate pairs of poles are complex conjugate and, therefore, if we assume that in

  • User’s Guide for D-Filter 22

    the case of an odd-order transfer function pN is real, Eq. (6) can be expressed as

    H(z) = K0 +N∑i=1

    Riz − pi

    =

    K0 +

    N/2∑i=1

    [Ri

    z − pi+

    R∗iz − p∗i

    ]if N is even

    K0 +

    (N−1)/2∑i=1

    [Ri

    z − pi+

    R∗iz − p∗i

    ]+

    RNz − pN

    if N is odd

    (7a)

    =

    K0 +

    ∑N/2j=1

    a0j + a1jz

    b0j + b1jz + b2jz2if N is even

    K0 +∑(N−1)/2

    j=1

    a0j + a1jz

    b0j + b1jz + b2jz2+

    a0Nb0N + b1Nz

    if N is odd(7b)

    Evidently, a transfer function in the form of residues and poles can be put in the standardsum form

    H(z) =J∑

    j=1

    a0j + a1jz + a2jz2

    b0j + b1jz + b2jz2where J =

    {N/2 if N is even

    (N + 1)/2 if N is odd(8)

    In this form, some of the coefficients may be zero. For example, if N is even and K0 happensto be zero, then all coefficients a2j for 1, 2, . . . , N/2 would be zero. If N is odd, then therewill be a partial transfer function with a1j = a2j = b2j = 0, and if K0 6= 0, then there will bea transfer function which is simply a constant and equal to K0, i.e., a1j = a2j = b1j = b2j = 0,b0j = 1, and a0j 6= 0. Fortunately, the user does not need to perform all the required algebra.Module Partial Fractions can give the output either in the residue-pole form of Eq. (6) orthe standard sum form of Eq. (9) as required.

    A continuous-time transfer function H(s) is similarly represented except that z is replacedby s in Eqs. (2)–(8).

    For causal nonrecursive filters, the transfer function can assume the general form

    H(z) =N−1∑i=0

    aiz−i =

    N−1∑i=0

    h(iT )z−i

    where N is the filter length or N − 1 is the filter order. The transfer function coefficients aifor 0, 1, . . . , N − 1 happen to be numerically equal to the values of the impulse response,namely, h(iT ) for 0, 1, . . . , N − 1 (see [4, 5]). Transfer functions for nonrecursive digitalfilters are stored in unformatted data files carrying the extension .irg, e.g., filename.irg, wereirg is an acronym for impulse response, general.

  • User’s Guide for D-Filter 23

    11.4 Nonrecursive Digital Filters

    If a nonrecursive filter has linear phase, then the transfer function can assume four formsdepending on the type of symmetry of the impulse response and whether the filter length isodd or even. In D-Filter, the following noncausal versions of the transfer function are used:

    Symmetrical impulse response, odd N :

    H(z) = h(0) +

    (N−1)/2∑i=1

    h(iT )(zi + z−i)

    Antisymmetrical impulse response, odd N :

    H(z) =

    (N−1)/2∑i=1

    h(iT )(−zi + z−i)

    Symmetrical impulse response, even N :

    H(z) =

    N/2∑i=0

    h[(i+ 12)T ](zi+1/2 + z−(i+1)/2)

    Antisymmetrical impulse response, even N :

    H(z) =

    N/2∑i=0

    h[(i+ 12)T ](−zi+1/2 + z−(i+1/2))

    These filters are described in terms of data files that carry the extension .irl, e.g., filename.irlwhere irl is an acronym for impulse response, linear phase response.

    Other frequently encountered unformatted data files are filename.fft which is used toprovide input to the FFT module, filename.noi for use as input for roundoff noise analysis,and filename.tim which is used to store a customized discrete-time signal for time-domainanalysis.

    12. Exercises

    Below, several exercises are described that are designed to familiarize the user with themodules, options, and capabilities of D-Filter.

    12.1 Exercise 1 – Time-Domain Response

    A digital filter is characterized by the difference equation

    y(nT ) = 12x(nT − 2T )− αy(nT − T )− βy(nT − 2T ) (9)

    and the sampling frequency is 2π rad/s.

  • User’s Guide for D-Filter 24

    (a) Assuming that α = −1.0 and β = 0.1, find the time-domain response of the filter for0 ≤ n ≤ 42 if the input signal is a sinusoid of the form

    x(nT ) = sinωnT

    where ω = 0.3 rad/s.

    (b) Find the unit-step response of the filter for each of the following sets of coefficients:

    (i) α = −1.0, β = 0.1(ii) α = −1.0, β = 0.5(iii) α = −1.0, β = 0.9

    for 0 ≤ n ≤ 40. Then compare the unit-step responses obtained.

    (c) Assuming the filter coefficients in item (ii) above, find the time-domain response of thefilter to the input signal

    x(nT ) =

    0 for 0 ≤ n ≤ 91 for 10 ≤ n ≤ 300 for 31 ≤ n ≤ 50

    for 0 ≤ n ≤ 50.

    (d) The transfer-function coefficients of a digital parallel elliptic highpass filter are givenin Table 4. The filter has a stopband edge frequency of 1.9 rad/s, a passband edgefrequency of 2.0 rad/s, and the sampling frequency is 2π rad/s. Plot the time-domainsinusoidal response of the filter if the frequency of the input sinusoid is 0.3 rad/s as inpart (a).

    Table 4 Coefficients of a Digital Parallel Elliptic

    Highpass Filter

    -------------------------------------------------------

    H(z)=H0*[H1(z)+H2(z)+...]

    H1(z)=(A01+A11z+A21z^2)/(B01+B11z+B21z^2)

    Section #: 1

    -------------------------------------------------------

    A[ 0 1]: 8.441627E-0003 B[ 0 1]: 1.000000E+0000

    -------------------------------------------------------

    Section #: 2

    -------------------------------------------------------

    A[ 0 2]: -2.989734E-0001 B[ 0 2]: 6.743668E-0001

    B[ 1 2]: 1.000000E+0000

    -------------------------------------------------------

    Section #: 3

    -------------------------------------------------------

  • User’s Guide for D-Filter 25

    A[ 0 3]: 3.217894E-0001 B[ 0 3]: 5.970103E-0001

    A[ 1 3]: 2.203021E-0001 B[ 1 3]: 1.093338E+0000

    B[ 2 3]: 1.000000E+0000

    -------------------------------------------------------

    Section #: 4

    -------------------------------------------------------

    A[ 0 4]: -1.105230E-0001 B[ 0 4]: 8.602544E-0001

    A[ 1 4]: 2.763276E-0002 B[ 1 4]: 7.814675E-0001

    B[ 2 4]: 1.000000E+0000

    -------------------------------------------------------

    H0: 1.000000E+0000

    -------------------------------------------------------

    Theory: See Secs. 2.5 and 5.2 in [5].

    Solution, Part (a): The first thing to do is to get the transfer function of the filter. FromEqs. (1a), (2c), and (9), we have

    H(z) =1

    2

    (1

    β + αz + z2

    )The Time-Domain Response module can be run through the selection of actions

    Analysis > Time Domain

    which will cause the Select Filter dialog box to pop up. Since the filter to be analyzed is anew filter, we select New filter which will start the Filter Configuration dialog box.

    As mentioned in Sec. 11.3, a transfer function in the product or sum form represents acascade or parallel arrangement of filter sections. Since we are dealing with a second-ordertransfer function which is normally realized as a single filter section, we can regard the filterconfiguration to be either a cascade or parallel one. Let’s choose Cascade configuration. Inthe data field for the number of sections we enter 1 and for the multiplier constant H0 weenter 0.5.

    Upon clicking button Next, the Filter Coefficients dialog box will appear which requiresthe numerator and denominator orders as well as all the coefficients. We enter 0 for thenumerator order since the numerator is a constant equal to unity and 2 for the denominatororder in the top part of the Filter Coefficients dialog box. Upon entering the numerator anddenominator orders, a matrix of data fields of the correct size will appear in the bottom partof the Filter Coefficients dialog box in which the numerator and denominator coefficients ofthe transfer function can be entered. We enter 1.0 for A[0, 1], β = 0.1 for B[0, 1], α = −1.0for B[1, 1], and 1.0 for B[2, 1]. The data is typically typed in but the copy-and-paste methodcan also be used if the coefficient values are available in a text file.

    At the bottom right-hand corner of the Filter Coefficients dialog box, a check box Saveunformatted input data file is provided which would enable a user to save a new filter that

  • User’s Guide for D-Filter 26

    has been entered into D-Filter’s data bank, for example, if there is a possibility that thenew filter might need to be analyzed again. The default choice is to save the filter data butthe user can disable it by clicking on the check box. Assuming that the Save option is kept,the data will be stored in two input data files, namely, a .coe coefficient data file and a .zpszeros and poles data file. Note that the .zps data file is not needed for the present analysisbut it is generated on the fly just in case it might be needed later. It should be mentionedthat D-Filter will generate a .zps file only in the case where the transfer function is in theproduct form (see Exercises 9 and 10 for details).

    Clicking the Next button will cause the Save Unformatted Data Files dialog box toappear. The default file name “untitled” with no extension is provided by D-Filter, whichcan be adopted unless the user wishes to select some other unique file name (see Sec. 8).There is no need to add the extension because the appropriate extension will be addedautomatically by D-Filter. Should the user enter an extension anyway, it will just be ignoredby D-Filter, which is quite all right particularly if the extension entered is wrong.

    The digital filter for part (a) will also be used in part (b) of the solution below and,therefore, we need to save the filter coefficients in an unformatted data file with a uniquename. So let us choose, say, file name exe1a-i, and click Save to complete the input process.At this point, D-Filter saves the unformatted data in files exe1a-i.coe and exe1a-i.zps in thecurrent Home folder.

    As stated earlier, unformatted data files are standard text files and can be viewed if needbe by associating them with a standard text editor and then opening them in the usual way.For example, to view file exe1a-i.coe, we can select

    File > Open

    which will cause the Open dialog box of the Windows system to appear. We then clickbutton Open on the Open dialog box and browse to file exe1a-i.coe to open it. Note thatthis action cannot be completed while a D-Filter pop-up dialog box is displayed. In such acase the dialog box should be closed before attempting to open a file. Also be sure to selectoption Files of type: “All files” to ensure that all the files in the Home folder are displayedin the window of the Open dialog box because D-Filter uses quite a variety of extensions inaddition to .txt and several types of files will normally populate the Home folder.

    If a keying error is noticed in the entered input data, say, if the value of the multiplierconstant H0 entered in the Configuration dialog box is wrong, the user can click buttonCancel to terminate the input stage. Selecting

    Analysis > Time-Domain > Change stored filter

    will restart the process from the beginning except that the parameters entered before willbe retrieved from the D-Filter data bank and will appear as default values. This is quitehandy because the user can parse through the data fields and correct any erroneous entries.Whatever you do in this situation, do not click the Erase button as that will reset D-Filterto its initial state and thereby delete any data entered in the Configuration dialog box.

  • User’s Guide for D-Filter 27

    When the filter data is successfully saved, a dialog box will appear with three differentinput options to select from, namely,

    • Standard signals

    • Input on file

    • Customized input

    Option Standard signals provides a collection of, well what else, standard signals such asthe unit impulse, unit step, sinusoid, or unit ramp. Option Input on file tells D-Filter toread the input signal from a data file stored in the Home or some other folder, and optionCustomized input instructs D-Filter to create a customized signal that could be used asinput in the current or a later session.

    Since the input is a standard sinusoid, we select the Standard signals option and clickthe Next button.

    The Standard signals dialog box will appear which will enable us to select option Sinusoidas input and to supply the number of samples, the sample index at the start of the sinusoid,the sampling frequency, and the frequency of the input sinusoid. Default values are suppliedby D-Filter but can be changed if they are not appropriate. In this example, we enter 42for the number of samples and 0.3 rad/s1 for the frequency of the input sinusoid but let thesinusoid start at the default sample value n = 0 and accept the default sampling frequency,2π, rad/s which happens to be of the correct value. On the same dialog box, D-Filterprovides an option that allows the user to save the input signal but the default is not to savethe input signal. In the present example, the input signal happens to be a standard sinusoidwhich can be readily generated by D-Filter and, consequently, there is no need to save it.This option would be useful when a customized input signal is entered manually through thekeyboard as in the solution of part (c) below.

    Clicking Next causes D-Filter to present the Plot Options dialog box. The user can chooseto plot just the input signal, just the output signal, both input and output signals on separategraphs, or both input and output signals on one graph. The user can also select to save thetime-domain response produced in an unformatted as well as a formatted data file. Let uschoose the third option from the top, namely, Plot both on separate graphs. On the PlotOptions dialog box, the user can also choose to save the time-domain response produced inan output formatted and/or unformatted data file. The numerical values of the time-domainresponse are often needed for this or that purpose and, consequently, the default is to save itin an output formatted file. On the other hand, an unformatted version of the time-domainresponse would be needed only if this is going to be used as an input signal to another filterbut this situation would not arise very often and, therefore, the default is not to save anunformatted data file. Let us choose to save both a formatted as well as an unformatted datafile. Clicking button Next, the Save File As dialog box appears providing the usual default

    1Note that D-Filter always assumes the frequency to be in radians per second or rad/s for short.

  • User’s Guide for D-Filter 28

    file name, i.e., untitled. Changing the file name to sinusoid-resp-exe1a will cause the outputformatted and unformatted data files sinusoid-resp-exe1a.txt and sinusoid-resp-exe1a.tim tobe produced and immediately after that the required plots will be displayed.

    At this point, we can review the data files saved. To see the output formatted data file,we perform the actions

    File > Open > sinusoid-resp-exe1a.txt > Open

    The file will show the filter coefficients, input signal, and time-domain response nicely orga-nized. On the other hand, if we select

    File > Open > sinusoid-resp-exe1a.tim > Open

    the unformatted output file will be opened which will show just two columns of numbers,the index n, and the time-domain response.

    Solution, Part (b): It is always a good idea to reset D-Filter before the start of a newanalysis or design project. This will clear all graph windows and reset D-Filter to its start-upstate. So we click the Erase button. We note that the filter coefficients in item (i) are exactlythe same as in part (a) of Exercise 1. Therefore, the filter of interest can be loaded in theD-Filter data bank by simply reading unformatted data file exe1-i.coe. Hence we performthe sequence of actions

    Analysis > Time Domain > Filter on file > exe1-i.coe > Standard signals

    and select Unit step as input. We accept the default start of the signal, i.e., n = 0 and setthe number of samples to 40 as required. On the Plot options, we select Plot output only.We then do

    Analysis > Time Domain > New filter

    and enter the coefficients in item (ii) above and obtain the plot of the corresponding unit-step response as before. We then repeat this procedure for the coefficients in item (iii) andonce more we obtain the plot of the corresponding unit-step response. Be sure to save theunformatted input data files, say, as exe1b-ii.coe and exe1b-iii.coe, for future use.

    At this point, three graph windows will be present in the Home window of D-filter and byclicking Vertical or Horizontal tiling on the toolbar, we will see the three unit-step responsesobtained one below the other or one next to the other. If the instructions were followedfaithfully and without error, the unit-step responses illustrated in Fig. 6 will be obtained.The three responses from top to bottom represent the classical overdamped, critically-damped,and underdamped system, respectively.

    Manual entry of input data is obviously quite laborious but fortunately we do not needto use the keyboard or cut-and-paste the data very often. With few exceptions, the inputdata is usually available in the D-Filter data bank or in an unformatted data file which wasproduced previously by some other module of D-Filter.

  • User’s Guide for D-Filter 29

    (a)

    (b)

    (c)

    Figure 6 (a) Overdamped, (b) critically-damped,(c) underdamped system (Exercise 1, part (b)).

    Solution, Part (c): Before we start part (c) of the solution, we click the Erase button toreset D-Filter. We then do

    Analysis > Time Domain > Filter on file > exe1-ii.coe >

    to load the filter coefficients in item (ii) above into the D-Filter data bank. On the Time-Domain Response dialog box, we select Customized input and click Next. The CustomizedInput dialog box appears which will enable us to enter the nonzero samples of the signal.We first enter the number of nonzero samples, namely, 21, and after that we enter the values

  • User’s Guide for D-Filter 30

    n x(nT )10 111 1...

    ...30 1

    in the matrix created by D-Filter; subsequently, we click Next. In the Save UnformattedInput File dialog box, we could accept the default file name untitled.tim but in this part ofthe exercise we choose a customized file name instead, say, pulse, which will cause D-Filterto produce an unformatted input data file pulse.tim for future use.

    Should a file with the same name exist, D-Filter will display a warning that a file withthe chosen name already exists and will prompt the user to choose between replacing and notreplacing the existing file by the new file. If you have not noticed it already, D-Filter will notprovide a warning if a file with the default name “untitled” is about to replace an existingfile with the same name. It will simply overwrite the previous file. This is not a softwarebug: D-Filter was designed that way to minimize interruptions by warning messages and toprevent D-Filter from overcrowding the Home folder with unnecessary files. In other words,if the data needs to be saved for future use, the golden rule is to use a unique file name toensure that it cannot be overwritten by accident (see Sec. 8).

    On the Plot Options dialog box, select Plot both on separate graphs to see the customizedinput and the response produced by this input. The oscillations noted at the start and endof the output pulse waveform are often referred to as ringing.

    Solution, Part (d): This part is very similar to part (a) except that we now have a moresubstantial filter than in part (a). As in part (a), we select

    Analysis > Time Domain > Select Filter > New filter

    which will start the Filter Configuration dialog box. Table 4 shows that we now have aparallel filter comprising four sections. So we select Parallel and enter 4 sections but leavethe default value of the multiplier constant to stand. Clicking Next will cause the FilterCoefficients dialog box to appear. Since there are 4 sections in this filter, 8 slots appear for thenumerator and denominator orders at the top of the dialog box. The first section is actuallyjust a multiplier which will multiply its input by a constant equal to A[0,1]/B[0,1] but it needsto be entered as if it were a digital-filter section. It is actually a trivial sort of filter with azeroth-order transfer function, so we enter 0 and 0 for section 1 in the top part of the FilterCoefficients dialog box and immediately enter the values of coefficients A[0,1] and B[0,1].We could then key the coefficients of section 3, i.e., A[0, 3], A[1, 3], B[0, 3], B[1.3], B[2, 3] andthose of section 4, i.e., A[0, 4], A[1, 4], B[0, 4], B[1.4], B[2, 4] but it would be easier by far tocopy-and-paste them for this User’s Guide. I did.

    We then click Next which will cause the Filter Coefficients dialog box to pop up. In thetop part of the dialog box, we enter the numerator and denominator orders of the first section,namely, 2 and 2, which will initialize the coefficients of the first section in the bottom part of

  • User’s Guide for D-Filter 31

    the dialog box to zero values. The coefficients of the first section can be typed in or, betterstill, copied and pasted in the appropriate coefficient fields. The same procedure is repeatedfor the second section, that is, we enter the orders of the numerator and denominator forthe second section, i.e., 2 and 2, in the top part of the dialog box and immediately entercoefficients of the second section in the bottom part of the dialog box.

    When Next is pressed on the Filter Coefficients dialog box, a window will pop up witha warning message to the effect that D-Filter will produce only a .coe unformatted datafile. This is because, D-Filter always produces a .coe as well as a .zps file when the transferfunction is product form2. This should be of no concern because, a time- or frequency-domain response can be carried out using either the coefficients or the zeros and poles of thefilter. See Exercises 9 and 10 for details.

    Continuing as in part (a) to the plot options, we can select Plot both on separate graphswhich will cause D-Filter to plot the input and output graphs seen in Fig. 7b.

    The input signal is seen to be a nice sinusoid but the output signal looks like anything buta sinusoid. From system theory, analog as well as digital systems start up with a transience,and this is what we see in Fig. 7b over the first 30 samples. What is observed after that perioddoes not look like anything but in fact it is a sinusoid. As we are filtering the input signalwith a highpass filter that has a stopband edge frequency of 1.9 rad/s and the frequency ofthe sinusoid is just 0.3 rad/s, the input sinusoid is seriously attenuated by the stopband ofthe filter actually by a factor of at least 10,000 in this particular example.

    2It does so because it is an easy thing to do and the .zps file might be needed later on.

  • User’s Guide for D-Filter 32

    (a)

    (b)

    Figure 7 (a) Input sinusoid, (b) output sinusoid (Exercise 1, part (d)).

    12.2 Exercise 2 Partial Fractions

    The coefficients contained in file cas dig el lpf.coe 3represent a cascade, digital, elliptic, low-pass filter with a passband 0 to 0.55 rad/s and a stopband 0.67 to π rad/s. The samplingfrequency is 2π rad/s.

    (a) Obtain the coefficients of a corresponding parallel, digital, elliptic, lowpass filter, andsave the output data in files par dig el lpf.coe and par dig el lpf.txt.

    (b) Find the order of the filter.

    (c) Compare the time-domain responses of the cascade and parallel filters for the followinginput signals:

    • unit impulse that occurs at n = 0• unit step that starts at n = 10

    3This file and a number of other unformatted data files used in these exercises can be found in theinstallation folder of D-Filter, i.e., C:\Program Files (x86)\D-Filter\Projects\Data Files.

  • User’s Guide for D-Filter 33

    • unit ramp that starts at n = 20• sinusoid sinωnT with ω = 0.185 rad/s that starts at n = 0• sinusoid sinωnT with ω = 1.64 rad/s that starts at n = 0

    Theory: See Sec. 4.8.2 in [5].

    Solution, Part (a): Part (a) of the problem can be solved by using the Partial Fractionsmodule. The selection

    Analysis > Partial Fractions

    will cause the Select Filter dialog box to appear. Since the filter of interest is containedin the unformatted data file par dig el lpf.coe, we select Filter on file and click Next. TheOpen Input Data File dialog box will pop up. We browse to folder Projects/Data Files inthe installation folder of D-Filter, select the unformatted file of interest, and click the Openbutton to open the file.

    The Partial Fractions dialog box will be displayed in which we can select options Coef-ficients, Save unformatted data file, and Save formatted output file. These options wouldnormally be preselected since they happen to be the correct options most of the time.

    We click Next and enter the desired file name, i.e., par dig el lpf, on the Save OutputFiles As dialog box.

    We click Save and with File > Open we can check to see whether the required formattedand unformatted files have been created.

    Solution, Part (b): The order of the parallel filter can be determined by counting thenumber of poles of the transfer function. If we open par dig el lpf.txt, we note that thetransfer function has 3 complex-conjugate pairs of poles and, therefore, the filter order is 6.

    Solution, Part (c): The best way to compare the two designs is to find the time-domainresponses of the two filters for each input signal and then arrange the output waveformseither side by side or one above the other. After each pair of time-domain responses hasbeen compared, the graphs can be cleared by clicking the Clear All Windows button4 andthe responses for the next input signal can be obtained.

    The various time-domain responses will show that the two filters will produce exactlythe same response to the same excitation as expected and, therefore, the cascade and thederived parallel filter are said to be equivalent.

    4That’s the button with the file icon with an X superimposed over it.

  • User’s Guide for D-Filter 34

    12.3 Exercise 3 Sinusoidal Time-Domain Response of DigitalBandpass Filter

    Unformatted data file cas dig bpf.coe5 contains the coefficients of a digital bandpass filter.The specifications of the filter are as follows:

    • Lower stopband: 0 to 3.40 rad/s

    • Passband: 4.40 to 6.20 rad/s

    • Upper stopband: 7.12 to 10.0 rad/s

    • Passband ripple, Ap: 1.0 dB

    • Stopband loss, Aa: 57 dB

    • Sampling frequency: 20 rad/s

    Find the time-domain response of the bandpass filter to a sinusoidal input signal x(nT ) =sinωnT for three frequencies, one in the lower stopband, say, ω = 1.9 rad/s, one in thepassband, say, ω = 5.0 rad/s, and one in the upper stopband, say, ω = 8.4 rad/s. Thesinusoid starts at n = 0 and a suitable number of sample points is 301 for all cases. Whatconclusions can we draw from the three sinusoidal responses obtained?

    Try other frequencies in the lower stopband, passband, and upper stopband.

    Theory: See Secs. 2.5 and 5.5.1 in [5].

    Solution: The solutions of this and subsequent examples assume that D-Filter is in itsstart-up state. If it is not, then the Erase button should be clicked to put D-Filter in itsstart-up state.

    As in Exercise 2, we can open the unformatted data file of interest through the actions

    Analysis > Time Domain > Filter on file > cas dig bpf.coe

    In the Time-Domain Response dialog box, we select the Standard signal option and click theNext button. In the Standard Signals dialog box, we select the Sinusoid option and set thenumber of samples to 301, the start of the signal to 0, the sampling frequency to 20 rad/s,and the frequency of the sinusoid to 1.9 rad/s. There is no need to save the input signal inan unformatted file since the sinusoid is one of the standard signals that can be generatedby D-Filter. The default is not to save the input signal so we leave the Save input check-boxunchecked.

    We click Next and select Plot both on separate graphs on the Plot Options dialog boxto plot both the input and output signals on separate graphs. We may need to check some

    5See folder C:\Program Files (x86)\D-Filter\Projects\Data Files.

  • User’s Guide for D-Filter 35

    numerical values of the sinusoidal response and thus a formatted output file may turn outto be useful. On the other hand, an unformatted output data file will not be needed inthe present example. So we can leave the Save unformatted output file and Save formattedoutput fie options in their default states.

    At this point, we click Next to get the plots of the input signal and the sinusoidal responseproduced. Along with the plots, we get the ‘Save Sinusoid Data File dialog box which wouldenable us to choose a unique file name for the output data file. However, there is no need touse a unique file name since that would only slow the process down, so we accept the defaultfile name. As stated in Exercise 1, an output data file with the default file name would soonbe overwritten by another output data file produced by the same or another module butthis is not a serious problem. Should we find out later on that we need a previous sinusoidalresponse that has been overwritten, we could always regenerate the output data again. Itonly takes a second.

    It is convenient to click Horizontal tiling on the toolbar to get the two graphs arrangedhorizontally. We note that after some initial transience which lasts 70 to 80 samples, theamplitude of the output signal is practically zero. This is to be expected because the fre-quency of the input signal is in the lower stopband range and it is, therefore, rejected by thebandpass filter.

    The user may often enter wrong data by accident and, naturally, the graphs obtainedwould not be as expected. In such a situation, the user can click the Clear All Windowsbutton to clear all graph windows. One should be careful, however, NOT to click the Erasebutton because that would delete the current filter from the D-Filter data bank in additionto clearing all graph windows.

    We can now repeat the experiment for another signal frequency. We note that imme-diately after the first time-domain response the Transient Response (TR) button on thetoolbar has become active, and by clicking the TR button, we can carry out any number ofthe time-domain responses one after the other for the filter in D-Filter’s data bank withoutthe need of entering the coefficients or zeros and poles of the filter. We parse through thesame dialog boxes as before but choose a sinusoid frequency of 5.0 rad/s in this case. We notethat after some initial transience, the amplitude of the output signal is of the same order ofmagnitude as that of the input signal. This is not surprising. After all the frequency of 5.0rad/s is approximately in the middle of the passband and it is, therefore, passed by the filter.We can at this point check the amplitudes of the input and output signals by reviewing theformatted output data file untitle.txt if need be.

    We can now repeat the above procedure with the frequency of the sinusoid set to 8.4 rad/s.Once again, the amplitude of the output signal soon decays to zero since the frequency is inthe upper stopband.

  • User’s Guide for D-Filter 36

    12.4 Exercise 4 Filter Stability

    (a) A recursive digital filter is characterized by the transfer function

    H(z) =N(z)

    D(z)=

    z5

    6z5 + 5z4 + 4z3 + 3z2 + 2z + 1

    Is the filter stable or unstable?

    (b) Repeat part (a) for the transfer function

    H(z) =N(z)

    D(z)=

    z5

    z5 + 2z4 + 3z3 + 4z2 + 5z + 6

    Theory: See Sec. 5.3.1 in [5].

    Solution, Part (a): The stability of the filter can be ascertained by finding the poles ofthe transfer function. This is easily done by running module Roots of Polynomials with thedenominator polynomial of the transfer function, namely, D(z). This is achieved throughthe actions

    Analysis > Roots of Polynomials

    which will start the dialog box Roots of Polynomials. This will enable us to enter thepolynomial order as well as the coefficients. We enter 5 for the polynomial order and anarray of 5 fields will appear in which the coefficients can be entered. We enter the coefficientsof the polynomial starting with the coefficient of z0 and ending with the coefficient of zn,that is, we enter 1, 2, . . ., 6, in turn, and click Next. D-Filter will show the usual SaveFile As dialog box and after that it will finish the task with a zero plot for the denominatorpolynomial. As will be noted, the zeros of D(z), which are the poles of H(z), are inside theunit circle |z| = 1. We conclude, therefore, that the filter is stable.

    Solution, Part (b): Proceeding as above, we will find that in this case the transferfunction represents an unstable filter. Actually, its poles are the reciprocals of the poles ofthe transfer function in part (a) as can be easily verified.

    The stability of filters can be easily ascertained without the need to evaluate the polesof the transfer function by simply using the Jury-Marden stability criterion (see Sec. 5.3.3).

  • User’s Guide for D-Filter 37

    12.5 Exercise 5 Steady-State Sinusoidal Response

    The time-domain response of a digital filter to a sinusoidal input consists of two components,the transient component, yTR(nT ), and the steady-state component, ỹ(nT ), i.e.,

    y(nT ) = R[sinωnT ]= yTR(nT ) + ỹ(nT )

    = M(ω) sin[ωnT + θ(ω)]

    If the filter is stable, the transient component soon decays to zero and the output becomesa sinusoidal waveform of the form

    ỹ(nT ) = M(ω) sin[ωnT + θ(ω)]

    In other words, the amplitude of the input sinusoid is multiplied by M(ω) and a phase angleof θ(ω) is introduced by the filter. M(ω) and θ(ω) are said to be the gain and phase shift ofthe filter for obvious reasons. As functions of ω, M(ω) and θ(ω) are said to be the amplitudeand phase responses.

    (a) Unformatted data file cas dig el lpf.coe6 contains the coefficients of a cascade digitallowpass filter. Using D-Filter find the gain and phase shift of the filter at ω = 0.292rad/s assuming a sampling frequency ωs = 10 rad/s.

    (b) Find the gain of the filter at ω = 1.68 rad/s assuming the same sampling frequency.

    Theory: See Sec. 5.5.1 of [5].

    Solution, Part (a): The problem can be solved by finding the time-domain responseproduced by a sinusoidal input of unity amplitude and zero phase angle, i.e., x(nT ) =sinωnT . The amplitude of the output sinusoid at steady state is the gain and its phasedisplacement relative to the input sinusoid is the phase shift of the filter.

    To get the sinusoidal response, we do

    Analysis > Time Domain > Filter on file > cas dig el lpf.coe >Standard Signals > Sinusoid

    On the Standard Signals dialog box, we set the number of samples to 501, the initial n tozero, the sampling frequency to 10 rad/s, and the frequency of the sinusoid to ω = 0.292.We do not need to save the sinusoidal input signal in an unformatted data file, so we leavethe Save file check-box unchecked. We then click Next and select Plot both to plot the inputand output signals, and accept the default file name for the formatted output file. We clickNext to obtain the required plots and select horizontal tiling to facilitate comparison of thetwo plots. We note that the output starts as a distorted sinusoid but after some 230 samplesa good sinusoidal waveform is obtained as expected from the theory.

    6See folder C:\Program Files (x86)\D-Filter\Projects\Data Files.

  • User’s Guide for D-Filter 38

    The amplitude of the output sinusoid after sample 230 appears to be equal to unitywhich would make the gain of the filter at frequency ω = 0.292 rad/s approximately equal tounity. This is to be expected since this frequency is located inside the passband of the filter.A more accurate value of the gain can be obtained by opening and viewing the formattedoutput data file through the actions

    File > Open > untitled.txt > Open

    The amplitude of the output sinusoid after sample 230, which is numerically equal to thegain of the filter, can be obtained as 0.9998986.

    The phase response can be evaluated by reading the phase displacement of the outputsinusoid relative to the input sinusoid. This measurement can be facilitated by changing thelimits of the bottom axis in both input and output plots. We select

    Axes limits > Bottom axis

    and set the lower and upper limits to, say, 240 and 280, respectively. We note that thevalue of the input sinusoid at sample 242 has moved to location n = 249 in the outputwaveform and thus the displacement of the output sinusoid is 7 sampling periods. Since thesampling frequency ωs is equal to 10 rad/s and the sampling period is given by T = 2π/ωs,the sampling period is 0.6283 s. In other words, the displacement of the output waveformis 7 × 0.6283 = 4.398 s. The period of the input sinusoid extends from sample 242 tosample 277, give or take a little, which yields a period of approximately 34 × 0.6283 =21.362 s. Since 21.362 s correspond to 360◦, the phase shift of the filter works out toapproximately 4.398 × 360/21.362 ≈ 74◦. Since the output waveform is displaced to theright by 74◦ relative to the input waveform, the phase shift is negative, i.e., θ(ω) ≈ −74◦ or−74× 2π/360 = −1.2915 in rads.

    Solution, Part (b): Repeating the above experiment with ω = 1.68 rad/s the input andoutput waveforms can be plotted as before. Setting the limits of the bottom axis to 240 to280 and the limits of the left axis to −0.004 and 0.004, we note that the maximum positivevalue of the output sinusoid, i.e., the amplitude of the sinusoid, is 0.003 and it occurs atsample 242. This gives a gain of 0.003 or −50.5 dB. A more precise value of the amplitudeof the output sinusoid can be read in the formatted output file untitled.txt. At sample 242we read an amplitude of 2.709 × 10−3 which works out to a gain of −51.3 dB. The actualgain of the filter at ω = 1.68 rad/s is −52.8 dB and is equal to the negative of the minimumstopband attenuation as specified. The low value of the gain at ω = 1.68 rad/s is to beexpected since this frequency happens to be in the stopband of the filter.

    Note that there is no need to find the phase shift of the filter at ω = 1.68 rad/s. This isbecause the phase response of a filter over stopband frequencies is of little practical interestas any stopband signals are deemed to be noise to be rejected.

  • User’s Guide for D-Filter 39

    12.6 Exercise 6 Specifications of Filters

    The passband of a lowpass or highpass filter can be deduced by drawing a horizontal linethough the minimum passband gain. The frequency where the horizontal line intersectsthe amplitude response curve, ωp, defines the passband edge. The frequency range 0 to ωpdefines the passband of a lowpass filter and ωp to ωs/2 defines the passband of a highpassfilter. Similarly, the stopband of a lowpass or highpass filter can be deduced by drawinga horizontal line through the maximum of the stopband gain. The frequency where thehorizontal line intersects the amplitude response curve, ωa, defines the stopband edge. Thefrequency range 0 to ωa defines the stopband (or attenuation band) of a highpass filter andωa to ωs/2 defines the stopband of a lowpass filter.

    (a) By evaluating and plotting the amplitude response of the filter in Exercise 5(cas dig el lpf.coe) over the baseband, i.e., for the frequency range 0 to ωs/2, deducethe passband and stopband of the filter. The sampling frequency is ωs = 10 rad/s.

    (b) Evaluate and plot the amplitude response with respect to the passband. Hence obtainthe gain at frequency ω = 0.292 rad/s in dB.

    (c) Evaluate and plot the amplitude response with respect to the stopband. Hence obtainthe gain at frequency ω = 1.68 rad/s in dB.

    (d) Compare the values obtained in (b) and (c) with those obtained from the time-domainresponse in Exercise 5.

    (e) Evaluate and plot the phase response with respect to the passband. Hence find thephase shift at frequency ω = 0.292 rad/s in degrees. Compare the value obtained withthat obtained from the time-domain response in Exercise 5.

    (f) Plot the delay characteristic with respect to the passband.

    Theory: See Secs. 5.5.2, 5.8.3, and 11.2.1 in [5].

    Solution, Part (a): Amplitude and phase responses as well as delay characteristics canbe obtained by using module Analog/Recursive Filter through the selection

    Analysis > Frequency Domain > Analog/Recursive Filter> Filter on file> cas dig el lpf.coe

    By selecting Log or Linear the amplitude response can be obtained using either a log orlinear scale for the gain. On the other hand Phase or Group Delay give the phase responseor delay characteristic.

    Selecting Log on the Frequency Response dialog box, clicking Next, and entering 10 rad/sas the sampling frequency, 0 and 5 rad/s as the initial and final frequencies, respectively, and,

  • User’s Guide for D-Filter 40

    say, 5017 as the number of frequency points would cause the required amplitude response tobe plotted.

    Clicking Next will cause a Save formatted output file window to appear which wouldenable the user to select a customized name for the formatted output file. The typical userwould, as stated before, opt for the default file name, i.e., untitled which will result in aformatted output file untitled.txt.

    When the required amplitude response is obtained, the user can redefine the minimumand maximum of the y axis, which would enable one to obtain a well proportioned plot. Thiscan be done by selecting menu Axes limits. For example, one could reset the minimum andmaximum y axes limits by selecting

    Axes limits > Left Axis

    and entering −90 and 10 in the Minimum and Maximum fields, respectively.

    One could also change the minimum and maximum values of the x axis, for example, toview the passband of the filter, by choosing Bottom Axis in stead of Left Axis in the aboveselection. For more information on working with plots see the D-Filter Help system.

    Solution, Part (b): To be done.

    Solution, Part (c): To be done.

    Solution, Part (d): To be done.

    Solution, Part (e): To be done.

    Solution, Part (f): To be done.

    12.7 Exercise 7 Discrete- and Fast-Fourier Transforms

    Under Analysis, D-Filter also includes a Fast Fourier Transform module that can be used toobtain the discrete Fourier transform (DFT) of a signal or the inverse DFT.

    Once activated, the module can be executed by selecting Standard signals, Input on fileor New input. Input on file will allow the user to access an unformatted data file of the typefilename.fft. The data file should include the number of points N , which must be a powerof 2, in the first line followed by columns of the real and imaginary parts of the signal to beanalyzed (see the D-Filter Help System). A file filename.fft can be created by selecting Newinput. A large variety of standard examples can be accessed by selecting Standard signals.

    In this exercise, we use the DFT module to obtain the DFT of a signal comprising a sumof two sinusoids, namely,

    7The number of points should be large enough to get a smooth curve and 501 is large enough for mostcircumstances.

  • User’s Guide for D-Filter 41

    x(nT ) = A1 sinω1nT + A2 sinω2nT

    where A1 = 1.0, A2 = 2.0, ω1 = 1, and ω2 = 2 rad/s.

    Theory: See Chap. 7 of [5].

    Solution: A signal which is a sum of sinusoids can be generated by selecting

    Analysis > Discrete Fourier Transform > Standard signals

    Once we select the Standard signals option in the DFT Input dialog box, we click theNext button to start the DFT Standard Signals dialog box. Here we select Sum of sine wavesin the Sine Wave group. We enter 256 for the number of points, which is a power of 2.

    When Next is clicked, a second dialog box requests the number of frequency componentsas well as the frequency and amplitude for each component. We enter 2 for the number offrequency components and then enter a frequency of 1 rad/s and amplitude 1 for the firstcomponent and a frequency of 2 rad/s and amplitude 2 for the second component.

    Immediately after, the Transform Type dialog box appears where we select the DFToption. Clicking Next will bring up the Plot Options dialog box. Since we are interested indetermining the DFT of the input signal, we select the Input option in the options group.Input causes the input signal to be plotted, and the DFT/Inverse DFT module plots theDFT or the inverse DFT of the input.

    In the Plot group one can select the Real Part, Imaginary Part, Amplitude, Amplitudein dB, or Phase. When we select Real Part and click the Next button, the output data isstored in D-Filter’s data bank and the plot in Fig. 8a is obtained which represents the sumof the two sinusoids. Also, note that the DFT toolbar button is now enabled which can allowus to access the Plot Options dialog box directly since the output data is stored locally inD-Filter’s data bank.

    If we click the DFT button on the main toolbar and choose options Output and Ampli-tude, the amplitude spectrum of Fig. 8b is the outcome. The two frequency components andtheir mirror images are clearly evident.

    An interesting exercise here would be to click the DFT button to bring up the PlotOptions dialog box again. This time, select the Output option and then check moduleDFT/IDFT. The outcome of this operation would, of course, be the original input signal!

    Several other types of signals can be used in this exercise ranging from the usual windowfunctions to several frequently encountered discrete-time signals. In all these exercises, asampling frequency of 2π can be assumed.

  • User’s Guide for D-Filter 42

    (a)

    (b)

    Figure 8 A signal comprising two sinusoids and its amplitude spectrum:(a) Sum of two sinusoids, (b) amplitude spectrum.

    12.8 Exercise 8 Design of a Nonrecursive Filter

    Design a bandpass nonrecursive filter with a low cutoff frequency ωc1 = 1.0 rad/s, a highcutoff frequency ωc2 = 2.0 rad/s, and filter length N = 41, assuming a sampling frequencyωs = 6.0 rad/s. Use a Kaiser window with α = 3.5.

    Solution: This design is carried out by selecting

    Design > Nonrecursive Filters > Filters >Window Method > Fixed Length

    The Window Method dialog box will appear where we can choose

  • User’s Guide for D-Filter 43

    • Filter Type: Bandpass

    • Window Type: Kaiser

    • Parameter Alpha: 3.5

    • Input: Parameters of filter as specified.

    • Check options to save unformatted and formatted output.

    Theory: See Sec. 10.4 in [5].

    Clicking Next will bring up the Frequency Response dialog box where we have the optionto plot the gain on a logarithmic or linear scale. Let’s plot the gain using the Log option.After clicking Next, enter 0 and 3 rad/s for the initial and final frequencies, respectively.

    After clicking Next, we are prompted to save the output data files and the amplituderesponse plot is generated. Two data files are saved, untitled.txt and untitled.irl, unless wechanged the default filename.

    Note that if we choose to generate another amplitude-response plot, this can be done bysimply clicking the sequence

    Analysis > Frequency Domain > Nonrecursive Filter > Linear Phase> Stored Filter

    and then continuing as before.

    Option Nonrecursive Filter can also be used to design nonrecursive filters that wouldsatisfy prescribed specifications. In this mode, the user selects

    Design > Nonrecursive Filter > Filters > Window Method> Prescribed Specs

    The Window Method dialog is loaded as before but in this case with prescribed specificationsoptions which can be entered more or less in the same way as the parameters in the previousexercise. In this type of design, D-Filter determines the required filter length and appropriatevalue of parameter α for the Kaiser window on the basis of the specifications supplied.

    Clicking Next will start the Frequency Response dialog box as before.

    12.9 Exercise 9 Amplitude Response of a Cascade AnalogFilter

    An analog filter can be represented by the transfer function

  • User’s Guide for D-Filter 44

    H(s) = 0.07076(2.633 + s2)

    (0.376 + s)(0.495 + 0.306s+ s2)

    (a) Determine what type of filter it might be by obtaining the amplitude response.

    (b) Find the passband ripple and minimum stopband attenuation in dB.

    Theory: See Sec. 5.8 and Chap. 11 in [5].

    Solution: (a) The amplitude response of the filter can be obtained through the sequenceof actions

    Analysis > Frequency Domain > Analog/Recursive Filter

    which will cause the Select Filter dialog box to pop up. As this is a new filter that is notstored in D-Filter’s data bank, we select the option New filter and click Next to proceedto the next step which will cause dialog box Filter Configuration to pop up. As this is acontinuous-time transfer function, we choose option Analog under Filter Type. We note thatthe transfer function can be expressed as

    H(s) = 0.07076

    (1

    0.376 + s× 2.633 + s

    2

    0.495 + 0.306s+ s2

    )As the transfer function is in the product form, it would correspond to a cascade structureand so we select option Cascade under Filter Structure. We then enter 2 for the number offilter sections and H0 = 0.07076 for the multiplier constant.

    When we click Next, the Filter Coefficients dialog box will pop up which will enableus to enter the coefficients of the transfer function under consideration. Proceeding as inExercise 1, part (d), we enter 0 and 1 for the numerator and denominator orders of thefirst section in the top part of the dialog box and immediately enter the correspondingcoefficients, i.e., A[0,1]=1.0, B[0,1]=0.376, and B[1,1]]=1.0 in the bottom part of the dialogbox. We then enter 2 and 2 for the numerator and denominator orders of the second sectionin the top part of the dialog box and immediately enter the coefficients of the second section,i.e., A[0,2]=2.633, A[1,2]=0, A[2,2]=1.0 and B[0,2]=0.495, B[1,2]= 0.306, B[2,2]=1.0 in thebottom part of the dialog box.

    Clicking Next will cause the Save Unformatted Data Files dialog box to pop up in whichwe need to provide a file name. We can enter a customized file name, say, exe9, and clickbutton Save to save the unformatted data file for later use. No need to provide the extensions.D-Filter will do that automatically.

    As mentioned earlier, D-Filter saves two unformatted files for transfer functions in prod-uct form, in the present exercise exe9.coe and exe9.zps. The first file will contain the transferfunction coefficients and the second the zeros and poles of the filter. Either of the two files issufficient to carry out a time- or frequency-domain response. The .zps file is obtained on the

  • User’s Guide for D-Filter 45

    fly from the transfer function coefficients just in case it might be needed for some purposelater on.

    Immediately after the Save button is clicked, the Frequency Response dialog box will popup as usual. To get the amplitude response in dB, we allow the default option Log to standand click Next. The Frequency Range dialog box will appear and we can enter, say, 0 for theinitial frequency, 5 for the final frequency, and 501 for the number of points. Clicking Nextwill cause the amplitude response to be plotted and also cause the Save Formatted OutputFile dialog box to appear. We let the default file name, i.e., untitled.txt, stand for reasonsstated earlier and click Save. This will conclude, the amplitude-response session.

    We note that the filter under consideration is a lowpass filter of some sort.

    (b) In order to examine the behavior of the filter over the passband, we need to obtainan amplitude response over the passband. We note that the frequency-response button, FR,on the toolbar has become active after the first frequency response, which means that wecan obtain new frequency responses without entering the filter coefficients again.

    We click button FR and then button Next to get to dialog box Frequency Response.This time, we enter the frequency range 0 to 0.7, click Next and then Save on the SaveFormatted Output File dialog box to complete the frequency response. We note that thepassband amplitude response oscillates between 0 and 1.0 dB. In other words, the passbandripple which is the maximum minus the minimum passband amplitude response is 1.0 dB.

    The minimum stopband attenuation is the negative of the maximum stopband gain whichcan be estimated using the Cross Hair option of D-Filter. Returning to the first amplituderesponse by clicking on its window, we note that the stopband amplitude response has amaximu