0% found this document useful (0 votes)
52 views77 pages

Digital Filter Design Toolkit Reference Manual: August 1995 Edition Part Number 320953A-01

Nothing

Uploaded by

MAYANK KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views77 pages

Digital Filter Design Toolkit Reference Manual: August 1995 Edition Part Number 320953A-01

Nothing

Uploaded by

MAYANK KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Digital Filter Design

Toolkit Reference Manual

August 1995 Edition


Part Number 320953A-01

© Copyright 1995 National Instruments Corporation. All Rights Reserved.


Internet Support

GPIB: gpib.support@natinst.com
DAQ: daq.support@natinst.com
VXI: vxi.support@natinst.com
LabVIEW: lv.support@natinst.com
LabWindows: lw.support@natinst.com
HiQ: hiq.support@natinst.com

FTP Site: ftp.natinst.com


Web Address: www.natinst.com

Bulletin Board Support

BBS United States: (512) 794-5422 or (800) 327-3077


BBS United Kingdom: 01635 551422
BBS France: 1 48 65 15 59

FaxBack Support

(512) 418-1111 or (800) 329-7177

Telephone Support (U.S.)

Tel: (512) 795-8248


Fax: (512) 794-5678 or (800) 328-2203

International Offices

Australia 03 9 879 9422, Austria 0662 45 79 90 0, Belgium 02 757 00 20,


Canada (Ontario) 519 622 9310, Canada (Québec) 514 694 8521, Denmark 45 76 26 00,
Finland 90 527 2321, France 1 48 14 24 24, Germany 089 741 31 30, Hong Kong 2645 3186,
Italy 02 48301892, Japan 03 5472 2970, Korea 02 596 7456, Mexico 5 202 2544,
Netherlands 03480 33466, Norway 32 84 84 00, Singapore 2265886, Spain 91 640 0085,
Sweden 08 730 49 70, Switzerland 056 20 51 51, Taiwan 02 377 1200, U.K. 01635 523545

National Instruments Corporate Headquarters

6504 Bridge Point Parkway Austin, TX 78730-5039 Tel: (512) 794-0100


Important Information

Warranty
The media on which you receive National Instruments software are warranted not to fail to execute programming
instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced
by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do
not execute programming instructions if National Instruments receives notice of such defects during the warranty
period. National Instruments does not warrant that the operation of the software shall be uninterrupted or error free.
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside
of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping
costs of returning to the owner parts which are covered by warranty.
National Instruments believes that the information in this manual is accurate. The document has been carefully
reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments
reserves the right to make changes to subsequent editions of this document without prior notice to holders of this
edition. The reader should consult National Instruments if errors are suspected. In no event shall National Instruments
be liable for any damages arising out of or related to this document or the information contained in it.
EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR
IMPLIED, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR
A PARTICULAR PURPOSE. CUSTOMER'S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR
NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT
THERETOFORE PAID BY THE CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR
DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR
CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. This limitation of the
liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including
negligence. Any action against National Instruments must be brought within one year after the cause of action accrues.
National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The
warranty provided herein does not cover damages, defects, malfunctions, or service failures caused by owner's failure
to follow the National Instruments installation, operation, or maintenance instructions; owner's modification of the
product; owner's abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third
parties, or other events outside reasonable control.

Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical,
including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part,
without the prior written consent of National Instruments Corporation.

Trademarks
LabVIEW is a trademark of National Instruments Corporation.
Product and company names listed are trademarks or trade names of their respective companies.

WARNING REGARDING MEDICAL AND CLINICAL USE OF NATIONAL INSTRUMENTS PRODUCTS


National Instruments products are not designed with components and testing intended to ensure a level of reliability
suitable for use in treatment and diagnosis of humans. Applications of National Instruments products involving
medical or clinical treatment can create a potential for accidental injury caused by product failure, or by errors on the
part of the user or application designer. Any use or application of National Instruments products for or involving
medical or clinical treatment must be performed by properly trained and qualified medical personnel, and all
traditional medical safeguards, equipment, and procedures that are appropriate in the particular situation to prevent
serious injury or death should always continue to be used when National Instruments products are being used.
National Instruments products are NOT intended to be a substitute for any form of established process, procedure, or
equipment used to monitor or safeguard human health and safety in medical or clinical treatment.
Table
of
Contents

About This Manual


Organization of This Manual .........................................................................................ix
Conventions Used in This Manual ................................................................................x
Related Documentation .................................................................................................xi
Customer Communication ............................................................................................xi

Chapter 1
Overview of the Digital Filter Design Toolkit
Package Contents ..........................................................................................................1-1
Installation .....................................................................................................................1-1
Macintosh and Power Macintosh ....................................................................1-1
Windows .........................................................................................................1-2
Sun and HP-UX ..............................................................................................1-2
Introduction to Digital Filtering ....................................................................................1-3
IIR and FIR Filters ..........................................................................................1-4

Chapter 2
Digital Filter Design Application
Introduction ...................................................................................................................2-1
Operation: the Main Menu ..............................................................................2-3
Opening the Filter Design Panels ...................................................................2-3
Directly Loading a Filter Specification File ...................................................2-3
Editing the DFD Preferences ..........................................................................2-4
Quitting the DFD Application ........................................................................2-4
Digital Filter Design Panels ..........................................................................................2-4
Common Controls and Features .....................................................................2-4
Using the DFD Menu ........................................................................2-4
Saving Filter Specifications ........................................2-5
Loading Filter Specifications .....................................2-6
Saving Filter Coefficients ..........................................2-6
Analyzing Filter Designs ...........................................2-7
DAQ and Filter: Real-World Testing .........................2-7
Transferring Filter Designs ........................................2-7
Returning to the Main Menu ......................................2-8

© National Instruments Corporation v Digital Filter Design Toolkit Reference


Table of Contents

Panning and Zooming Options .................................. 2-8


Graph Cursors .................................................................................. 2-10
Classical IIR Filter Design ............................................................................. 2-10
Classical IIR Design Panel Controls and Displays .......................... 2-13
Classical FIR Design ...................................................................................... 2-16
Classical FIR Design Panel Controls and Displays ......................... 2-19
Pole-Zero Placement Filter Design ................................................................ 2-22
Pole-Zero Placement Panel Controls and Displays ......................... 2-24
Arbitrary FIR Design ..................................................................................... 2-29
Arbitrary FIR Filter Design Panel Controls and Displays ............... 2-30
Analysis of Filter Design Panel .................................................................................... 2-35
Analysis Displays ........................................................................................... 2-36
Magnitude Response ........................................................................ 2-37
Phase Response ................................................................................ 2-37
Impulse Response ............................................................................ 2-38
Step Response .................................................................................. 2-38
Z-Plane Plot ..................................................................................... 2-39
H(z) for IIR Filters ........................................................................... 2-39
H(z) for FIR Filters .......................................................................... 2-40
DAQ and Filter Panel ................................................................................................... 2-40

Chapter 3
IIR and FIR Implementation
Infinite Impulse Response Filters ................................................................................. 3-1
Cascade Form IIR Filtering ............................................................................ 3-2
Finite Impulse Response Filters ................................................................................... 3-4
Format of the Filter Coefficient Text Files ................................................................... 3-5
FIR Coefficient File Format ........................................................................... 3-5
IIR Coefficient File Format ............................................................................ 3-6

Chapter 4
Using Your Coefficient Designs: DFD Utilities
LabVIEW DFD Utilities ............................................................................................... 4-1
Read DFD Coefficients .................................................................................. 4-1
DFD Filter ...................................................................................................... 4-2
LabWindows/CVI Utilities .......................................................................................... 4-3
The DFD Instrument Driver ........................................................................... 4-3
AllocCoeffDFD............................................................................................... 4-4
ReadCoeffDFD ............................................................................................... 4-5
FreeCoeffDFD................................................................................................. 4-5

Digital Filter Design Toolkit Reference vi © National Instruments Corporation


Table of Contents

FilterDFD........................................................................................................ 4-6
Using the DFD Instrument Driver ................................................................. 4-6
Windows DLL DFD Utilities ....................................................................................... 4-7

Appendix A
References

Appendix B
Customer Communication

Glossary

Figures
Figure 2-1. Conceptual Overview of the Digital Filter Design Toolkit...................... 2-2
Figure 2-2. Filter Design Main Menu Panel .............................................................. 2-3
Figure 2-3. DFD Menu Popup ................................................................................... 2-5
Figure 2-4. Classical IIR Filter Design Panel ............................................................ 2-11
Figure 2-5. Magnitude vs. Frequency ........................................................................ 2-13
Figure 2-6. Classical FIR Design Panel ..................................................................... 2-17
Figure 2-7. Frequency Response Magnitude .............................................................. 2-19
Figure 2-8. Pole-Zero Placement Filter Design Panel ............................................... 2-23
Figure 2-9. Z-Plane plot of Filter Poles and Zeros .................................................... 2-24
Figure 2-10. Arbitrary FIR Design Panel .................................................................... 2-29
Figure 2-11. Desired and Actual Magnitude Response ............................................... 2-30
Figure 2-12. Analysis of Filter Design Panel ............................................................... 2-35
Figure 2-13. The DAQ and Filter Panel ....................................................................... 2-41
Figure 2-14. Switching Displays .................................................................................. 2-42

Tables
Table 2-1. Suggested Specification Filename Extensions......................................... 2-6
Table 2-2. Filter Specification Transfers................................................................... 2-7

© National Instruments Corporation vii Digital Filter Design Toolkit Reference


About
This
Manual

This manual describes the Digital Filter Design Toolkit package. You can
use this program to design digital filters.

Organization of This Manual


The manual is organized as follows:
• Chapter 1, Overview of the Digital Filter Design Toolkit, lists the
contents of the Digital Filter Design (DFD) Toolkit, contains
installation instructions, and introduces you to digital filtering and
design.
• Chapter 2, Digital Filter Design Application, describes the Digital
Filter Design application that you use to design infinite impulse
response (IIR) and finite impulse response (FIR) digital filters.
• Chapter 3, IIR and FIR Implementation, contains a description of
the filter implementation equations for IIR and FIR filtering, and
describes the format of the IIR and FIR filter coefficient files.
• Chapter 4, Using Your Coefficient Designs: DFD Utilities,
contains a description of the DFD Utilities that you use for your
LabVIEW, LabWindows/CVI, and Windows filtering
applications.
• Appendix A, References, lists the reference material used to
produce the Digital Filter Design Toolkit. For more information
about the theories and algorithms implemented in the Digital Filter
Design Toolkit, refer to the documents referenced in this section.
• Appendix B, Customer Communication, contains forms you can
use to request help from National Instruments or to comment on
our products and manuals.
• The Glossary contains an alphabetical list and description of terms
used in this manual, including abbreviations, acronyms, metric
prefixes, mnemonics, and symbols.

© National Instruments Corporation ix Digital Filter Design Toolkit Reference


About This Manual

Conventions Used in This Manual


The following conventions are used in this manual:
bold Bold text denotes menus, menu items, or dialog box buttons or options.
italic Italic text denotes emphasis, a cross reference, or an introduction to a
key concept.
bold italic Bold italic text denotes a note, caution, or warning.
monospace Lowercase text in this font denotes text or characters that are to be
literally input from the keyboard, sections of code, programming
examples, and syntax examples. This font is also used for the proper
names of disk drives, paths, directories, programs, subprograms,
subroutines, device names, functions, variables, filenames, and
extensions, and for statements and comments taken from program
code.
Warning: This icon to the left of bold italicized text denotes a warning, which
alerts you to the possibility of damage to you or your equipment.
Caution: This icon to the left of bold italicized text denotes a caution, which
alerts you to the possibility of data loss or a system crash.
Note: This icon to the left of bold italicized text denotes a note, which alerts
you to important information.
» The » symbol leads you through nested menu items and dialog box options
to a final action. The sequence
File»Page Setup»Options»Substitute Fonts
directs you to pull down the File menu, select the Page Setup item, select
Options, and finally select the Substitute Fonts option from the last
dialog box.
paths Paths in this manual are denoted using backslashes (\) to separate drive
names, directories, and files, as in drivename\
dir1name\dir2name\myfile

Abbreviations, acronyms, metric prefixes, mnemonics, symbols, and


terms are listed in the Glossary.

Digital Filter Design Toolkit Reference x © National Instruments Corporation


About This Manual

Related Documentation
The following documents contain information that you may find
helpful as you read this manual:
• LabVIEW Analysis VI Reference Manual
• LabVIEW Data Acquisition VI Reference Manual
• LabVIEW Tutorial
• LabVIEW User Manual
• LabWindows/CVI Advanced Analysis Library Reference Manual
• Getting Started with LabWindows/CVI
• LabWindows/CVI User Manual

Customer Communication
National Instruments wants to receive your comments on our products
and manuals. We are interested in the applications you develop with
our products, and we want to help if you have problems with them. To
make it easy for you to contact us, this manual contains comment and
configuration forms for you to complete. These forms are in
Appendix B, Customer Communication, at the end of this manual.

© National Instruments Corporation xi Digital Filter Design Toolkit Reference


Chapter

Overview of the Digital Filter


Design Toolkit 1
This chapter lists the contents of the Digital Filter Design (DFD) Toolkit,
contains installation instructions, and introduces you to digital filtering and
design.

Package Contents
Your Digital Filter Design Toolkit should contain the following
materials.
• The Digital Filter Design Toolkit diskettes.
• LabVIEW Digital Filter Design Toolkit Reference Manual, part
number 320953A-01.

Installation
The following sections contain instructions for installing the Digital Filter
Design Toolkit on the Macintosh, Windows, Sun SPARCstation, and HP-
UX platforms.

Macintosh and Power Macintosh


Complete the following steps to install the toolkit.
1. Insert disk 1 of the Digital Filter Design Toolkit into your 3.5 in.
disk drive and double-click on the DFD Toolkit Installer icon
when it appears on your desktop.
2. Follow the instructions on your screen.

Once you have completed the on-screen installation instructions, you


are ready to run the Digital Filter Design Toolkit.

© National Instruments Corporation 1-1 Digital Filter Design Toolkit Reference


Chapter 1 Overview of the Digital Filter Design Toolkit

Windows
Complete the following steps to install the toolkit.
1. Launch Windows.
2. Insert disk 1 of the Digital Filter Design Toolkit into your 3.5 in.
disk drive.
3. From the File Manager, run setup.exe.
4. Follow the instructions on your screen.

Once you have completed the on-screen installation instructions, you


are ready to run the Digital Filter Design Toolkit.

Sun and HP-UX


Complete the following steps to install the toolkit onto your hard drive.
1. Insert the Digital Filter Design Toolkit disk into your 3.5 in. disk
drive.
2. In the UNIX shell, enter the following line from a directory for
which you have write permission.
3. tar xvf /dev/rfd0a INSTALL
4. This entry will extract the installation script file, INSTALL.
5. Enter the following command to start the installation process:
6. ./INSTALL
7. Follow the instructions on your screen.

Once you have completed the on-screen installation instructions, you


are ready to run the Digital Filter Design Toolkit.

Digital Filter Design Toolkit Reference 1-2 © National Instruments Corporation


Chapter 1 Overview of the Digital Filter Design Toolkit

Introduction to Digital Filtering


Analog filter design is one of the most important areas of electronic
design. Although some analog filter design books feature simple, well
tested filter designs, filter design is often reserved for specialists
because it requires advanced mathematical knowledge and
understanding of the processes involved in the system affecting the
filter.

Modern sampling and digital signal processing tools have made it


possible to replace analog filters with digital filters in applications that
require flexibility and programmability. These applications include
audio, telecommunications, geophysics, and medical monitoring.

Digital filters have the following advantages over their analog


counterparts.
• They are software programmable.
• They are stable and predictable.
• They do not drift with temperature or humidity, or require
precision components.
• They have a superior performance-to-cost ratio.

The following discussion of sampling theory is intended to give you a


better understanding of the filter parameters and how they relate to the
input parameters.

The sampling theorem states that you can reconstruct a continuous-


time signal from discrete, equally spaced samples if the sampling
frequency is at least twice that of the highest frequency in the time
signal. Assume you can sample the time signal of interest at ∆t equally
spaced intervals without losing information. The ∆t parameter is the
sampling interval.

You can obtain the sampling rate or sampling frequency fs from the
sampling interval
1
f s = ----- ,
∆t
which means that, according to the sampling theorem, the highest
frequency that the digital system can process is
f
f Nyq = -----s .
2

© National Instruments Corporation 1-3 Digital Filter Design Toolkit Reference


Chapter 1 Overview of the Digital Filter Design Toolkit

The highest frequency a digital system can process is known as the


Nyquist frequency. This also applies to digital filters. For example, if
your sampling interval is

∆t = 0.001 sec,

then the sampling frequency is

fs = 1000 Hz,

and the highest frequency that the system can process is

fNyq = 500 Hz.

All frequency response designs in the DFD applications are therefore


limited to half the sampling rate.

IIR and FIR Filters


The digital filters designed using the DFD applications are either
Infinite Impulse Response (IIR) or Finite Impulse Response (FIR)
filters. IIR filters process both input and output samples. This allows
IIR filters to have very sharp transitions in their frequency response
characteristics, which is very useful in many applications. The
nonlinear phase distortion associated with IIR filters sometimes can
limit their selection in many phase sensitive systems.

FIR filters, however, process only input samples and can be designed
to have only linear phase distortion. The linear phase distortion can be
compensated by simple delays in the system. FIR filters may require
more coefficients than IIR filters to meet similar design specifications.

Digital Filter Design Toolkit Reference 1-4 © National Instruments Corporation


Chapter

Digital Filter Design Application 2


This chapter describes the Digital Filter Design application you use to
design infinite impulse response (IIR) and finite impulse response
(FIR) digital filters.

Introduction
The Digital Filter Design (DFD) application is a complete filter design
and analysis tool you can use to design digital filters to meet your
precise filter specifications. You can graphically design your IIR and
FIR filters, interactively review filter responses, save your filter design
work, and load your design work from previous sessions.

You can save digital filter coefficients for later implementation from
within LabVIEW and LabWindows CVI. Also, you can call Windows
DFD Dynamic Link Libraries (DLLs) from other applications, or other
applications can load the filter coefficient files directly. This manual
includes all required filter coefficient forms and implementation
equations.

If you have a National Instruments data acquisition (DAQ) device, you


can perform real-world filter testing from within the DFD application.
You can view the time waveforms or the spectra of both the input signal
and the filtered output signal while simultaneously redesigning your
digital filters. Figure 2-1 shows a conceptual overview of the Digital
Filter Design Toolkit and related applications.

© National Instruments Corporation 2-1 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Digital Filter
Design
Application

Save Load Data Acquisition


Save
and Filtering

Filter Specification Files Filter Coefficient Files

LabVIEW Windows DLL

LabWindows/CVI

Figure 2-1. Conceptual Overview of the Digital Filter Design Toolkit

Digital Filter Design Toolkit Reference 2-2 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Operation: the Main Menu


When you launch the DFD application, a panel displays the
mainavailableoptions. Figure 2-2 shows the Filter Design Main Menu
panel.

Figure 2-2. Filter Design Main Menu Panel

Opening the Filter Design Panels


From the Filter Design Main Menu Panel, you can open any of the four
digital filter design panels: Classical IIR Design, Classical FIR Design,
Pole-Zero Placement, and Arbitrary FIR Design. The next section of
this manual discusses each design panel.

Directly Loading a Filter Specification File


You can also load a previously designed filter specification file
directly from the Main menu. If you choose Main»Load Filter
Specification, the DFD application prompts you to select the filter
specification file that you saved during previous design work. After
you select the file, the application asks you if you want to open the
appropriate design panel for that specification file. This way, you can
easily resume work on an ongoing design project.

© National Instruments Corporation 2-3 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Editing the DFD Preferences


To customize your DFD application preferences, choose Main»
Preferences.... Then you can edit your DFD application preferences for
future design sessions.

Quitting the DFD Application


Choose Main»QUIT to quit the DFD application.

Digital Filter Design Panels


If you double-click on one of the four design selections in the Main
menu, the DFD application loads and runs the selected design panel.
You can use these design panels to design IIR or FIR filters, save your
design work and filter coefficients, or load previous filter designs.

After designing your filter, you can move from the design panels to the
Analysis of Filter Design panel to view various frequency domain and
time domain filter responses. Then you can save these responses to text
files for use in other applications. You can also perform real-world
testing of your filter designs by moving to the DAQ and Filter panel,
which performs data acquisition and filtering in parallel with your filter
designing.

Common Controls and Features

Using the DFD Menu


All four filter design panels, the Analysis of Filter Design panel, and
the DAQ and Filter panel have a DFD Menu from which you can select
a number of options. Figure 2-3 shows the DFD Menu popup for
theClassical IIR Design panel. This section discusses each DFD Menu
option.

Digital Filter Design Toolkit Reference 2-4 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Figure 2-3. DFD Menu Popup

Saving Filter Specifications


To save all your specifications for the present filter design panel, select
DFD»Save Spec.... The DFD application prompts you for the name of
the filter specification file to save. You should name your spec files
appropriately for a given filter design. For example, if you design a
lowpass IIR filter, a good name is lowpass.iir, or lowp1 if this
design is the first of many lowpass IIR designs. Table 2-1 lists
suggested filename extensions for the four filter design panels. These
names are simply suggested extensions and have no effect on how
theDFD application interprets the file contents.

© National Instruments Corporation 2-5 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Table 2-1. Suggested Specification Filename Extensions

Design Panel Filename

Classical IIR Design filename.iir

Classical IIR Design filename.fir

Pole-Zero Placement filename.pz

Arbitrary FIR Design filename.arb

Loading Filter Specifications


To load a filter specification file into the present filter design panel,
select DFD»Load Spec.... the DFD application prompts you for the
location of the filter specification file to load. If the selected spec file
is the same type design as the present design panel, the DFD
application loads the specification from the selected file into the
present design panel for viewing, editing, or analyzing.

If you designed the selected spec file in a different design panel than
the present panel, the DFD application prompts you to open the
appropriate design panel for that specification file. For example, if you
are using the Pole-Zero Placement panel and you load a specification
file saved from within the Classical FIR Design panel, the DFD
application prompts you to open the Classical FIR Design panel to
resume work on the loaded filter specifications.

Saving Filter Coefficients


To save all your filter coefficients to a file, select DFD»Save Coeff....
The DFD application first prompts you for the format of the coefficient
file. You can select text format or log format. Use text format to view
or print the coefficient file, or to use the coefficients in other non-
LabVIEW filtering applications. Use log format for LabVIEW-only
filtering applications, although LabVIEW filtering utilities can read
both text and log formatted coefficient files.

After you select the format of the coefficient file, the DFD application
prompts you for the name of the filter coefficient file to save. You
should name your coefficient files appropriately for a given filter
design. For example, if you save bandpass IIR filter coefficients, a

Digital Filter Design Toolkit Reference 2-6 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

good name is “bpiir.txt” or “bpiir.log,” depending on the coefficient


file type.

Analyzing Filter Designs


To begin analyzing your filter design, choose DFD»Analysis. The DFD
application loads and runs the Analysis of Filter Design panel. From
this analysis panel, you can view the filter magnitude response, phase
response, impulse response, step response, and pole-zero plot. You can
also view and print full-screen plots of each response. From the full-
screen views, you can save the analysis results to a text file.

DAQ and Filter: Real-World Testing


If you have a National Instruments DAQ device and you want to see
how the present filter design performs on real-world signals, choose
DFD»DAQ and Filter. The DFD application loads and runs the DAQ
and Filter panel. From this panel, you can set up your DAQ device and
then acquire real signals. The acquired data then passes through the
currently designed filter, and the DFD application plots the input and
output waveforms and spectrums.

Transferring Filter Designs


You can transfer some filter design specifications from one design
panel to another. For example, you can set up your passband and
stopband requirements in designing an FIR filter, and see what kind of
IIR filter meets your design specifications. Not all design panels can
share specifications. Table 2-2, Filter Specification Transfers, shows
the allowable transfers and their corresponding DFD menu options.

Table 2-2. Filter Specification Transfers

Design Transfer DFD Menu Option

Filter specs from the Classical IIR to Xfer Classical FIR


Classical FIR

Filter specs from the Classical FIR to Xfer Classical IIR


Classical IIR

Poles and zeros from Classical IIR to Xfer Pole Zero


Pole-Zero Placement

© National Instruments Corporation 2-7 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Returning to the Main Menu


To return to the DFD Main menu, choose DFD Menu»Main Menu in
each panel.

Panning and Zooming Options


The graph palette is included with any graph you drop onto the front
panel. This palette has controls for panning (scrolling the display area
of a graph) and for zooming in and out of sections of the graph. The
graph palette is included with many DFD graphs. A graph with its
accompanying graph palette is shown in the following illustration.

Graph

Palette

If you press the x autoscale button, shown at the left, the DFD
application autoscales the X data of the graph. If you press the
y autoscale button, shown at the left, the DFD application autoscales
the Y data of the graph. If you want the graph to autoscale either of the
scales continuously, click on the lock switch, shown at the left, to lock
autoscaling on.

The scale format buttons, shown left, give you run-time control over
the format of the X and Y scale markers respectively.

You use the remaining three buttons to control the operation mode for
the graph.

Digital Filter Design Toolkit Reference 2-8 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Normally, you are in standard operate mode, indicated by the plus or


crosshatch. In operate mode, you can click in the graph to move cursors
around.

If you press the panning tool, shown to the left, you switch to a mode
in which you can scroll the visible data by clicking and dragging
sections of the graph.

If you press the zoom tool, shown at the left, you can zoom in on a
section of the graph by dragging a selection rectangle around that
section. If you click on the zoom tool, you get a pop-up menu you can
use to choose some other methods of zooming. This menu is shown in
the following illustration.

A description of each of these options follows.

Zoom by rectangle.

Zoom by rectangle, with zooming restricted to x data (the y scale


remains unchanged.

Zoom by rectangle, with zooming restricted to y data (the z scale


remains unchanged).

Undo last zoom. Resets the graph to its previous setting.

Zoom in about a point. If you hold down the mouse on a specific point,
the graph continuously zooms in until you release the mouse button.

Zoom out about a point. If you hold down the mouse on a specific
point, the graph continuously zooms out until you release the mouse
button.

Note: For the last two modes, you can zoom in and zoom out about a point .
Shift-clicking zooms in the other direction.

© National Instruments Corporation 2-9 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Graph Cursors
Following are illustrations of a waveform graph showing two cursors
and the cursor movement control.

Cursor movement control

You can move a cursor on a graph or chart by dragging it with the


Operating tool, or by using the cursor movement control. Clicking the
arrows on the cursor movement control causes all cursors selected to
move in the specified direction. You select cursors by moving them on
the graph with the Operating tool.

Classical IIR Filter Design


Figure 2-4 shows the Classical IIR Filter Design panel. The panel
includes a graphical interface with the Magnitude vs. Frequency
cursors and plot on the left side and a text-based interface with digital
controls on the right side.

Digital Filter Design Toolkit Reference 2-10 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Figure 2-4. Classical IIR Filter Design Panel

Use this panel to design classical IIR digital filters. These filters
include the classic types (lowpass, highpass, bandpass, and bandstop)
and the classic designs (Butterworth, Chebyshev, Inverse Chebyshev,
and Elliptic).

To design classical IIR filters, adjust the filter specifications. The


passband and stopband requirements define a filter specification. You
can fully define these requirements by using either text entry or the
cursors in the Magnitude vs. Frequency graph. As you use the mouse
to click and drag the cursors, the text entries update. Likewise, as you
enter new specifications in the text entries, the cursors update.

The lower passband frequency fp1, and upper passband frequency fp2,
and the passband response Gp, define the passband specification. For
the bandpass filter, the passband ranges from fp1 to fp2. The passband
is the region in the frequency domain with a response near 1.0. Gp is
the minimum allowable passband gain or filter magnitude response. In
Figure 2-4, the passband is specified as having a minimum gain of -5
dB between the frequencies of fp1 = 1900 Hz and fp2 = 2600 Hz.

© National Instruments Corporation 2-11 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

The passband is defined as:


lowpass (0 ≤ f ≤ fp1)
highpass (fp1 ≤ f ≤ fsamp/2)
bandpass (fp1 ≤ f ≤ fp2)
bandstop (0 ≤ f ≤ fp1, fp2 ≤ f ≤ fsamp/2)

where:
fp1 = passband frequency 1
fp2 = passband frequency 2
fsamp = sampling rate

The lower stopband frequency, fs1 and the upper stopband frequency
fs2, and the stopband attenuation, Gs, define the stopband
specification. For the bandpass filter, the stopband ranges from 0.0
(DC) to the lower stopband frequency, fs1, and from the upper
stopband frequency, fs2, to half the sampling rate (Nyquist). The
stopband is that region in the frequency domain with a response near
0.0. Gs is the minimum acceptable stopband attenuation or filter
magnitude response. In Figure 2-4, Classical IIR Filter Design Panel,
the stopband specification is a minimum attenuation of -40 dB between
the frequencies of 0 and
fs1 = 1500 Hz and between the frequencies of
fs2 = 2600 Hz and 4000 Hz.

The stopband is defined as:


lowpass (fs1 ≤ f ≤ fsamp/2)
highpass (0 ≤ f ≤ fs1)
bandpass (0 ≤ f ≤ fs1, fs2 ≤ f ≤ fsamp/2)
bandstop (fs1 ≤ f ≤ fs2)

where:
fs1 = stopband frequency 1
fs2 = stopband frequency 2
fsamp = sampling rate

In this panel, the DFD application estimates the minimum filter order
that the selected type and design require to meet or exceed the modified
filter specifications. The DFD application computes other appropriate
filter parameters and designs and plots the IIR filter automatically. You

Digital Filter Design Toolkit Reference 2-12 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

see immediate graphical feedback to help you determine whether the


filter meets your specifications.

Classical IIR Design Panel Controls and Displays


Use the design panel DFD menu to save your filter specifications and
coefficients, load filter designs from previous work, open the Analysis
or the DAQ and Filter panels, transfer the IIR design specifications to
the FIR design panel, transfer the poles and zeros to the Pole-Zero
placement panel, or return to the Filter Design Main Menu.

The graph in Figure 2-5, Magnitude vs. Frequency, plots the frequency
response H(f) magnitude of the designed digital filter.

Figure 2-5. Magnitude vs. Frequency

The y-axis is in linear or decibel units, depending on how you set the
button in the upper left corner of the graph.

The x-axis is in units of hertz. The full scale ranges from 0.0 to Nyquist
(sampling rate/2).

By moving the blue cursor lines or crosshairs, you control the passband
response (horizontal lines) and the passband frequencies (vertical
lines).

© National Instruments Corporation 2-13 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

By moving the red cursor lines, you control the stopband attenuation
(horizontal lines) and the stopband frequencies (vertical lines).

These cursors represent the filter design specifications for the selected
classical IIR filter. In the passband, the filter has a gain of ≥ specified
passband response. In the stopband, the filter has a gain of ≤ specified
stopband attenuation.

Use the linear/dB button to control the display units (linear or dB) of
dB
all magnitude and gain controls and displays. These controls and
displays include Magnitude vs. Frequency plot (y-axis), passband
response, stopband attenuation, and tracking cursor magnitude.

The frequency and magnitude indicators display the location of the


tracking transparent square cursor.This cursor is locked to the
frequency response H(f), so moving this cursor updates the frequency
and magnitude digital displays with data points from H(f), as shown
below.

The complete filter specifications can be entered using the text entry
portion at the upper right-hand side of the design panel.

The passband response is the minimum gain in the passband. The


horizontal blue cursor line represents this response in the Magnitude
vs. Frequency plot.

Digital Filter Design Toolkit Reference 2-14 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

In the passband, the filter gain is guaranteed to be at least as high as the


specified passband response, Gp:
|H(f)| ≥ Gp.

The first passband frequency defines one frequency edge of the


passband. The vertical blue cursor lines represent this frequency in the
Magnitude vs. Frequency plot.

The second passband frequency defines the second frequency edge of


the passband. The vertical blue cursor lines represent this frequency in
the Magnitude vs. Frequency plot.

The stopband attenuation is the minimum attenuation in the stopband.


The horizontal red cursor line represents this attenuation in the
Magnitude vs. Frequency plot.

In the stopband, the filter gain is guaranteed to be no higher than the


specified stopband attenuation, Gs:
|H(f)| ≤ Gs.

The first stopband frequency defines one frequency edge of the


stopband. The vertical red cursor lines represent this frequency in the
Magnitude vs. Frequency plot.

The second stopband frequency defines the second frequency edge of


the stopband. The vertical red cursor lines represent this frequency in
the Magnitude vs. Frequency plot.

The sampling rate control specifies the sampling rate in samples per
second (hertz).

The type control specifies one of four classical filter types according
to the following values:
0:lowpass
1:highpass
2:bandpass
3:bandstop

© National Instruments Corporation 2-15 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

The design control specifies one of four classical filter design


algorithms according to the following values:
0: Butterworth
1: Chebyshev
2: Inverse Chebyshev
3: Elliptic

The filter order indicator, shown below, displays the estimated filter
order of the classical IIR filter. The DFD application automatically
estimates the filter order as the lowest possible order that meets or
exceeds the desired filter specifications.

The message window displays errors that occur during the IIR design
procedure. Usually these errors reflect filter specifications which are
inconsistent with the chosen filter type.

message

Classical FIR Design


Figure 2-6 shows the Classical FIR Design panel. This panel is very
similar to the Classical IIR Design panel and operates in much the same
way. The panel includes a graphical interface with the Magnitude vs.
Frequency cursors and plot on the left side, and a text-based interface
with digital controls on the right side.

Digital Filter Design Toolkit Reference 2-16 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Figure 2-6. Classical FIR Design Panel

Use the Classical FIR Design panel to design classical FIR digital
filters. These filters include the classic types (lowpass, highpass,
bandpass, and bandstop) and use the Parks-McClellan equiripple FIR
filter design algorithm.

To design classical FIR filters, adjust the desired filter specifications.


The desired passband and stopband requirements define a filter
specification. You can fully define these requirements by using either
text entry or the cursors in the Magnitude vs. Frequency graph. As you
move the cursors, the text entries update. Likewise, as you enter new
specifications into the text entries, the cursors update.

The lower passband frequency, fp1 and upper passband frequency fp2,
and the passband response, Gp, define the passband specification. For
the bandpass filter, the passband ranges from fp1 to fp2. The passband
is the region in the frequency domain with a response near 1.0. Gp is
the minimum acceptable passband gain or filter magnitude response. In
Figure 2-6, the passband specification is a minimum gain of -5 dB
between the frequencies of fp1 = 1900 Hz and fp2 = 2600 Hz.

© National Instruments Corporation 2-17 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

The passband is defined as:


lowpass (0 ≤ f ≤ fp1)
highpass (fp1 ≤ f ≤ fsamp/2)
bandpass (fp1 ≤ f ≤ fp2)
bandstop (0 ≤ f ≤ fp1, fp2 ≤ f ≤ fsamp/2)

where:
fp1 = passband frequency 1
fp2 = passband frequency 2
fsamp = sampling rate

The stopband frequencies, fs1 and fs2, and the stopband attenuation, Gs,
define the stopband specification. For the bandpass filter, the stopband
ranges from 0.0 (DC) to the lower stopband frequency, fs1, and from the
upper stopband frequency, fs2, to half the sampling rate (Nyquist). The
stopband is the region in the frequency domain with a response near 0.0.
Gs is the minimum acceptable stopband attenuation or filter magnitude
response. In Figure 2-6, the stopband specification is a minimum
attenuation of -40 dB between the frequencies of 0 and fs1 = 1500 Hz and
between the frequencies of fs2 = 2600 Hz and 4000 Hz.

The stopband is defined as:


lowpass (fs1 ≤ f ≤ fsamp/2)
highpass (0 ≤ f ≤ fs1)
bandpass (0 ≤ f ≤ fs1, fs2 ≤ f ≤ fsamp/2)
bandstop (fs1 ≤ f ≤ fs2)

where:
fs1 = stopband frequency 1
fs2 = stopband frequency 2
fsamp = sampling rate

The Classical FIR Design panel estimates the minimal filter order that
the selected type and design require to meet or exceed the modified
filter specifications. The DFD application automatically computes
other appropriate filter parameters and designs and plots the FIR filter.
You see immediate graphical feedback to help you determine whether
the filter meets your specifications.

Digital Filter Design Toolkit Reference 2-18 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Classical FIR Design Panel Controls and Displays


These controls are virtually identical to those in the Classical IIR
Design panel, with a few additions (a minimize filter order button and
an error message display box).

Use the design panel DFD Menu to save your filter specifications and
coefficients, load filter designs from previous work, open the Analysis
or the DAQ and Filter panels, transfer the FIR design specifications to
the IIR design panel, or return to the Filter Design Main Menu.

The graph in Figure 2-7 plots the frequency response H(f) magnitude
of the designed digital filter.

Figure 2-7. Frequency Response Magnitude

The y-axis is in linear or decibel units, depending on how you set the
button in the upper left corner of this graph.

The x-axis is in hertz. The full scale ranges from 0.0 to Nyquist
(sampling rate/2).

The blue cursor lines control the passband response (gain in the
passband and horizontal lines) and the passband frequencies (vertical
lines).

© National Instruments Corporation 2-19 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

The red cursor lines control the stopband attenuation (gain in the
stopband and horizontal lines) and the stopband frequencies (vertical
lines).

These cursors represent the filter design specifications for the selected
classical IIR filter. In the passband, the filter has a gain of ≥ specified
passband response. In the stopband, the filter has a gain of ≤ specified
stopband attenuation.

The dB button controls the display units (linear or decibel) of all


dB magnitude and gain controls and displays. These controls and displays
include Magnitude vs. Frequency plot (y-axis), passband response,
stopband attenuation, and tracking cursor magnitude.

The frequency and magnitude indicators display the location of the


tracking transparent square cursor. This cursor is locked to the
frequency response H(f), so moving this cursor updates the frequency
and magnitude digital displays with data points from H(f), as shown
below.

The complete filter specifications can be entered using the text entry
portion at the upper right-hand side of the design panel.

Digital Filter Design Toolkit Reference 2-20 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

The passband response is the minimum gain in the passband. The


horizontal blue cursor line represents this response in the Magnitude
vs. Frequency plot.

In the passband, the filter gain is guaranteed to be at least as high as the


specified passband response, Gp:
|H(f)| ≥ Gp.

The first passband frequency defines one frequency edge of the


passband. The vertical blue cursor lines represent this frequency in the
Magnitude vs. Frequency plot.

The second passband frequency defines the second frequency edge of


the passband. The vertical blue cursor lines represent this frequency in
the Magnitude vs. Frequency plot.

The stopband attenuation is the minimum attenuation in the stopband.


The horizontal red cursor line represents this attenuation in the
Magnitude vs. Frequency plot.

In the stopband, the filter gain is guaranteed to be no higher than the


specified stopband attenuation, Gs:
|H(f)| ≤ Gs.

The first stopband frequency defines one frequency edge of the


stopband. The vertical red cursor lines represents this frequency in the
Magnitude vs. Frequency plot.

The second stopband frequency defines the second frequency edge of


the stopband. The vertical red cursor lines represent this frequency in
the Magnitude vs. Frequency plot.

The sampling rate control specifies the sampling rate in samples per
second (hertz).

The type control specifies one of four classical filter types according
to the following values:
0: lowpass
1: highpass
2: bandpass
3: bandstop

The filter order indicator displays the estimated filter order of the
classical FIR filter.

© National Instruments Corporation 2-21 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

The DFD application automatically estimates the filter order as the


lowest possible order that meets or exceeds the desired filter
specifications.

The minimize filter order button controls whether the DFD application
minimizes the estimated filter order. If this button is off, the DFD
application uses a fast formula to estimate the filter order to meet or
exceed the desired filter specifications. If this button is on, the DFD
application iteratively adjusts the filter order until it finds the minimum
order that meets or exceeds the filter specifications.

The message window displays errors that occur during the FIR design
procedure. These errors occur when the filter specifications are
inconsistent with the chosen filter type.

message

Pole-Zero Placement Filter Design


Figure 2-8 shows the Pole-Zero Placement filter design panel. The
panel includes a graphical interface with the z-plane pole and zero
cursors on the left side and a text-based interface with digital controls
on the right side.

Digital Filter Design Toolkit Reference 2-22 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Figure 2-8. Pole-Zero Placement Filter Design Panel

Use the Pole-Zero Placement Filter Design panel to design IIR digital
filters by manipulating the filter poles and zeros in the z plane. The
poles and zeros initially may have come from classical IIR designs.
Use this panel to move existing poles and zeros directly on the z plane
plot. You can add and delete poles and zeros and accurately control
their important characteristics.

You can fully describe the poles and zeros by using either the text entry
or the cursors in the z-plane plot. As you change the cursors, the text
entries update automatically. Likewise, as you modify the text entries,
the pole/zero cursors update automatically.

The pole and zero locations in the z-plane, the characteristics of each
pole and zero, the gain, and the sampling rate fully describe pole-zero
filter designs. Any change in these parameters corresponds to a change
in the filter coefficients. The DFD application matches the poles and

© National Instruments Corporation 2-23 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

zeros and creates stable second-order stages for IIR filter coefficients.
The DFD application then uses these coefficients to compute the filter
magnitude response. The Magnitude vs. Frequency plot updates
automatically whenever you change the poles or zeros, for immediate
graphical feedback to your pole-zero filter designs.

Pole-Zero Placement Panel Controls and Displays


Use the design panel DFD menu to save your filter specifications and
coefficients, load filter designs from previous work, open the Analysis
or DAQ and Filter panels, or return to the Filter Design Main menu.

Figure 2-9 shows the z-plane plot of the filter poles and zeros. You can
move each pole (red “x”) anywhere within the unit circle, along and
above the x-axis. You can move each zero (blue “o”) anywhere along
and above the x-axis.

Figure 2-9. Z-Plane plot of Filter Poles and Zeros

delete Click on the delete selected button to delete the selected pole or zero.
selected Click on poles and zeros to select them.

add pole Click on the add pole button to add a pole to the z-plane. The new pole
is located at the origin.

Click on the add zero button to add a zero to the z-plane. The new zero
add zero
is located at the origin.

Digital Filter Design Toolkit Reference 2-24 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

The coordinates control specifies how the DFD application displays


the poles and zeros, either in rectangular or polar coordinates.

The following figure shows the array of zeros in rectangular


coordinates. The complex value of each zero represents its rectangular
position on the z-plane. The integer 3 in the left box is the displayed
zero index. By changing this index value, you can display a particular
zero in the array of zeros. When you select a particular zero in the z-
plane plot, the DFD application sets the index value of the array to the
selected zero.

If you click in the real check box, the zero becomes purely real and is
limited to real-axis movement.

If you click in the lp check box, the zero has linear phase. That is, if the
zero is not real or on the unit circle, the DFD application matches it
with another zero at a radius of 1/r, where r is the radius of the original
zero (the radius is the distance from the origin). Linear phase zeros are
important in linear phase FIR filters. If your z-plane plot contains only
zeros, and all the zeros have linear phase, then the FIR filter you
designed has an overall linear phase response.

If you click on the uc check box, the zero is forced to be located on the
unit circle (radius of 1.0) and is limited to movement along the unit
circle.

The order text entry is the order of the zero, or the number of actual
zeros at this location in the z plane.

© National Instruments Corporation 2-25 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

An Mth-order zero at z = b has a z-transform of


H(z) = (z-b)M

The following figure shows the array of poles in rectangular


coordinates. The complex value of each pole represents its rectangular
position on the z-plane. The integer 0 in the left box is the displayed
pole index. By changing this index value, you can specify which pole
in the array of poles displays. When you select a particular pole in the
z-plane plot, the DFD application sets the index value of the array to
the selected pole.

Only one special characteristic applies to poles—whether they are real.


If you click in the real check box, the pole becomes purely real and is
limited to real-axis movement.

The order text entry specifies the pole order, or the number of actual
poles at this location in the z plane.

An Mth-order pole at z = a has a z-transform of


H(z) = (z-a)-M

Digital Filter Design Toolkit Reference 2-26 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

If you change the coordinates to polar coordinates, the DFD


application displays the poles and zeros in polar coordinates.

The following graph plots the frequency response H(f) magnitude of


the designed digital filter.

The y-axis is in linear or decibel units, depending on how you set the
button in the upper left corner of this graph.

The x-axis is in hertz. The full scale ranges from 0.0 to Nyquist
(sampling rate/2).

© National Instruments Corporation 2-27 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

The sampling rate control specifies the sampling rate in samples per
second (hertz).

sampling rate

8.0000E+3

The gain control specifies the gain constant for the designed filter.
Increasing this gain increases the overall gain of the designed filter.

Setting the normalize button to Normalize On adjusts the filter gain so


that the maximum response is 1.0 (0 dB). If you set this button set to
“Normalize On,” you cannot manually adjust the gain control.

Digital Filter Design Toolkit Reference 2-28 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Arbitrary FIR Design


Figure 2-10 shows the Arbitrary FIR Design panel. The panel includes
a graphical interface with the Magnitude vs. Frequency cursors on the
left side and a text-based interface with digital controls on the right
side.

Figure 2-10. Arbitrary FIR Design Panel

Use the Arbitrary FIR Design panel to design arbitrary-magnitude FIR


digital filters. Enter or modify the array magnitude response points
(frequency and magnitude). From these points, the DFD application
forms a desired magnitude response that covers the entire frequency
range from 0.0 to half the sampling rate. the DFD application then
takes this desired response, along with the filter order, and uses the
Parks-McClellan algorithm to design an optimal equiripple FIR filter.
The Parks-McClellan algorithm minimizes the difference between the
desired and actual filter response across the entire frequency range.

To design arbitrary-magnitude FIR filters, enter or modify the desired


frequency-magnitude points and choose an interpolation type to

© National Instruments Corporation 2-29 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

generate the desired response between your specified points. The DFD
application automatically designs and plots the equiripple FIR filter.
You get immediate graphical feedback to help determine whether the
filter meets your specifications.

Arbitrary FIR Filter Design Panel Controls and


Displays
Use the design panel DFD Menu to save your filter specifications and
coefficients, load filter designs from previous work, open the Analysis
or DAQ and Filter panels, or return to the Filter Design Main Menu.

The graph in Figure 2-11 plots the desired and actual magnitude
response of the designed FIR filter.

Figure 2-11. Desired and Actual Magnitude Response

The y-axis is in linear or decibel units, depending on how you set the
button in the upper left corner of the graph. The x-axis is in hertz. The
full scale ranges from 0.0 to Nyquist (sampling rate/2).

The dB button controls the display units (linear or decibel) of all the
dB magnitude controls and displays.

These controls and displays include the Magnitude vs. Frequency plot
(y-axis) and the magnitudes in the array of frequency-magnitude
points.

Digital Filter Design Toolkit Reference 2-30 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

The # points control specifies the total number of frequency-magnitude


points the DFD application uses to create the desired filter magnitude
response.

# points
10

Reducing this number deletes points from the end of the frequency-
magnitude array, while increasing this number inserts the additional
number of points to the right of the selected point.

Set the multiple selection button to on to select more than one


frequency-magnitude point on the response graph. Clicking on a point
you already selected removes that point from the selection list.

The interpolation control selects the type of interpolation the DFD


application uses to generate the desired response from the array of
frequency-magnitude points.

linear interpolation

Choose linear interpolation to create “flat” filters (lowpass, highpass,


bandpass, and bandstop). Choose spline interpolation to create
smoothly-varying filters.

Click on the insert button to insert a frequency-magnitude point


ins between the selected point and the next point.

If the selected point is the last point in the frequency-magnitude array,


the DFD application inserts the new point between the last two points
of the array.

The DFD application inserts new points at halfway along the line
connecting the two outer points.

Click on the delete button to delete the selected frequency-magnitude


del points. The DFD application deletes all selected points.

© National Instruments Corporation 2-31 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

These points are the selected frequency-magnitude points. You can


select points on the Arbitrary Magnitude Response graph by clicking
on the point, or directly from the frequency-magnitude array shown at
right by clicking on the circle to the right of each point.

The following array is the array of frequency-magnitude points the


DFD application uses to construct the desired filter magnitude
response. The DFD application forms the desired filter response by
interpolating between these points.

Digital Filter Design Toolkit Reference 2-32 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

The frequency of each point is in hertz and the magnitude is in linear


or decibel units of gain, depending on the setting of the button in the
upper left corner of the Arbitrary Magnitude Response graph.

You can select points in this array by clicking in the circle to the right
of each point. You can then delete the selected points by clicking on
the delete button, or move them by clicking on the desired direction
diamond in the lower right corner of the Arbitrary Magnitude Response
graph.

The filter order control specifies the total number of coefficients in the
digital FIR filter.

© National Instruments Corporation 2-33 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

The ripple indicator displays the largest absolute error (linear) between
the desired and actual filter responses.

ripple 1.3709E-2

The Message window displays errors that occurred during the FIR
design procedure.

message

Click in the locked frequencies box to lock the present frequency


values of the frequency-magnitude points. If you click in this box, you
can alter only the magnitude or y-value of the frequency-magnitude
points.

Click in the uniform spacing box to space the frequency values of the
frequency-magnitude points. The DFD application spaces the
frequency-magnitude points uniformly from 0.0 to sampling rate/2,
inclusive.

Click in the sort by frequency box to sort the frequency-magnitude


points in both the response graph and the array according to ascending
frequency.

The value of each frequency-magnitude point remains unchanged;


however, the point order may change.

The sampling rate control specifies the sampling rate in samples per
second (hertz).
sampling rate 8000.00

Digital Filter Design Toolkit Reference 2-34 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Analysis of Filter Design Panel


Figure 2-12 shows the Analysis of Filter Design panel. Use this panel
to view the filter magnitude response, phase response, impulse
response, step response, and pole-zero plot. You can also view and
print full-screen plots of each response. From the full-screen views,
you can save the analysis results to text files.

Figure 2-12. Analysis of Filter Design Panel

If you selected DFD Menu»Analysis from a filter design panel, the


Analysis of Filter Design panel uses that particular filter design to
compute the various filter responses. You can also analyze any of the
four filter designs from the Design Analyzed ring selector; the Analysis
of Filter Design panel uses the filter parameters from the selected filter
design.

Use the DFD Menu to load filter designs from previous work, open the
DAQ and Filter panel, go to the selected filter design panel, or return
to the Filter Design Main Menu.

© National Instruments Corporation 2-35 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Use the Design Analyzed control to select which filter control to


analyze. If you continue to modify the same filter design that is
presently being analyzed, the DFD will recompute all filter responses.

Analysis Displays
Each of the five filter plots has a zoom box in the upper right corner.
Clicking in this box brings up a full-screen version of that plot. In the
zoom full-screen versions of these plots, you can change the units from linear
box to decibel (magnitude response), from radians to degrees (phase
response) or from seconds to samples (impulse and step responses).
From each full screen view, you can save the response data to text files.

Digital Filter Design Toolkit Reference 2-36 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Magnitude Response
The magnitude response is the magnitude of the filter’s response H(f)
as frequency caries from zero to half the sampling rate.

The following figure illustrates the magnitude response of the selected


filter design.

Phase Response
The phase response is the phase of the filter’s response H(f) as
frequency varies from zero to the sampling rate.

The following figure illustrates the phase response of the selected filter
design.

© National Instruments Corporation 2-37 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Impulse Response
The impulse response of a digital filter is the filter’s output when the
input is a unit sample sequence (1, 0, 0,...). The input before the unity
sample is also zero.

The following figure illustrates the phase response of the selected filter
design.

Step Response
The step response of a digital filter is the filter’s output when the input
is a unit step sequence (1, 1, 1, ...). The input samples before the step
sequence is defined as zero.

The following figure illustrates the step response of the designed filter.

Digital Filter Design Toolkit Reference 2-38 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

Z-Plane Plot
The following figure illustrates the z-plane plot of the filter poles and
zeros.

Each pole is represented by a red “x”. Each zero is represented by a


blue “o”.

H(z) for IIR Filters


H(z) is the z-transform of the designed digital filter.

For an IIR filter, H(z) can be represented by a product of fractions of


second order z polynomials.
Ns
Nk(z)
H(z) = ∏ -------------
Dk ( z )
-
k=1

Nk(z) = numerator for stage k

Dk(z) = denominator for stage k

Ns = number of second-order stages

© National Instruments Corporation 2-39 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

You can view the N(z) and D(z) polynomials for other stages by
incrementing the index shown in the upper left hand side of the H(z)
display.

H(z) for FIR Filters


H(z) is the z-transform of the designed digital filter, as illustrated by
the following figure. You can scroll through H(z) using the scroll bar
at the right.

For an FIR filter, H(z) can be represented as a polynomial in z^-1.


order – 1


–j
H(z) = h jz
j=0

where
j=0, 1, ... order -1
hj= FIR filter coefficients
order = number of FIR coefficients

DAQ and Filter Panel


Figure 2-13 shows the DAQ and Filter panel. You can use this panel if
you have a National Instruments DAQ device and you want to see how
the present filter design performs on real-world signals. In this panel,
you can set up your DAQ device and then acquire real signals. The

Digital Filter Design Toolkit Reference 2-40 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

acquired data then passes through the currently designed filter, and the
DFD application plots the input and output waveforms and spectrums.

Figure 2-13. The DAQ and Filter Panel

If you select DFD Menu»DAQ and Filter from a filter design panel,
the DAQ and Filter panel uses that particular set of filter coefficients
when filtering the acquired signals. You can also use any of the four
filter designs from the Filter Design ring selector; the DAQ and Filter
panel uses the filter parameters from the selected design specifications.

Use the DFD Menu to load and test filter designs from previous work,
open Analysis panel, goto the selected filter design panel, or return to
the Filter Design Main Menu.

Use the Filter Design control to set the Filter Design to use in filtering
of the acquired signal. From the DFD menu select “Goto Design” to
load and run the corresponding filter design panel.

© National Instruments Corporation 2-41 Digital Filter Design Toolkit Reference


Chapter 2 Digital Filter Design Application

Use the on/off switch to control whether you want the DFD to acquire
blocks continuously or on demand.

Set the switch to “on” to continuously acquire blocks of data.

Set the switch to “off” to acquire when “ACQUIRE ONCE” button is


clicked.

Click on the DAQ Setup button to change the data acquisition settings
such as the device number, number of samples to acquire, triggering
parameters, or sampling rate.

Select between viewing the Time Waveform or the Spectrum of the


input acquired signal or the filtered signal, using the ring selector,
shown just above each response plot. Figure 2-14 shows an example of

switching displays for the spectrum of both the input and filtered
signals:

Figure 2-14. Switching Displays

Digital Filter Design Toolkit Reference 2-42 © National Instruments Corporation


Chapter 2 Digital Filter Design Application

The actual sampling rate is shown in an indicator at the lower left-hand


side of the DAQ and Filter Panel, as in the following figure.

© National Instruments Corporation 2-43 Digital Filter Design Toolkit Reference


Chapter

IIR and FIR Implementation 3


This chapter contains a description of the filter implementation equations
for IIR and FIR filtering, and describes the format of the IIR and FIR filter
coefficient files.

Infinite Impulse Response Filters


Infinite impulse response filters (IIR) filters are digital filters with
impulse responses that can theoretically be infinite in length (duration).
The general difference equation characterizing IIR filters is

N –1 Na – 1
 b 
y i = ------ ∑ b j x i – j – ∑ a k y i – k 
1
(3-1)
a0  
 j=0 k=1 

where Nb is the number of forward coefficients (bj) and Na is the


number of reverse coefficients (ak).

In most IIR filter designs, coefficient a0 is 1. The output sample at the


present sample index i consists of the sum of scaled present and past
inputs (xi and xi-j when j ≠ 0) and scaled past outputs (yi-k).

The response of the general IIR filter to an impulse (x0 = 1 and xi = 0


for all i ≠ 0) is called the impulse response of the filter. The impulse
response of the filter described by equation (3-1) is indeed of infinite
length for nonzero coefficients. In practical filter applications,
however, the impulse response of stable IIR filters decays to near zero
in a finite number of samples.

The advantage of digital IIR filters over finite impulse response (FIR)
filters is that IIR filters usually require fewer coefficients to perform
similar filtering operations. Thus, IIR filters execute much faster and
do not require extra memory, because they execute in place.

The disadvantage of IIR filters is that the phase response is nonlinear.


If the application does not require phase information, such as simple

© National Instruments Corporation 3-1 Digital Filter Design Toolkit Reference


Chapter 3 IIR and FIR Implementation

signal monitoring, IIR filters may be appropriate. You should use FIR
filters for those applications requiring linear phase responses.

IIR filters are also known as recursive filters or autoregressive


moving-average (ARMA) filters. See Appendix A, References, for
material that can give you more information on this topic.

Cascade Form IIR Filtering


Filters implemented using the structure defined by equation 3-1
directly are known as direct form IIR filters. Direct form
implementations are often sensitive to errors introduced by coefficient
quantization and by computational precision limits. Additionally, a
filter designed to be stable can become unstable with increasing
coefficient length, which is proportional to filter order.

A less sensitive structure can be obtained by breaking up the direct


form transfer function into lower order sections, or filter stages. The
direct form transfer function of the filter given by equation 3-1 (with
a0 = 1) can be written as a ratio of z transforms, as follows:

b0 + b1 z –1 + … + b N – 1 z –( N b – 1 )
H ( z ) = --------------------------------------------------------------------------------
b
- (3-2)
1 + a1 z –1 + … + a N – 1 z –( N a – 1 )
a

By factoring equation 3-2 into second-order sections, the filter's


transfer function becomes a product of second-order filter functions

Ns
b 0k + b 1k z –1 + b 2k z –2
H(z) = ∏ ----------------------------------------------------
1 + a z –1 + a z –2
(3-3)
k=1 1k 2k

where N s = N a ⁄ 2 is the largest integer ≤ Na/2, and Na ≥ Nb. This


new filter structure can be described as a cascade of second-order
filters.

x[i] stage 1 stage 2 stage N s y[i]

Cascaded Filter Stages

Digital Filter Design Toolkit Reference 3-2 © National Instruments Corporation


Chapter 3 IIR and FIR Implementation

Each individual second-order stage can be implemented using the


direct form filter equations:

y[i] =b0x[i] + b1x[i-1] + b2x[i-2]- a1y[i-1] - a2y[i-2]

These direct form equations can be represented graphically as follows.

For each stage, you must maintain two past inputs (x[i-1], x[i-2]) and
two past outputs (y[i-1], y[i-2])

A more efficient implementation of each second-order stage is known


at the direct form II. Each individual second-order stage can be
implemented using the direct form II filter equations:

s[i] = x[i] - a1s[i-1] - a2s[i-2]

y[i] = b0s[i] + b1s[i-1] + b2s[i-2]

© National Instruments Corporation 3-3 Digital Filter Design Toolkit Reference


Chapter 3 IIR and FIR Implementation

These direct form II equations can be represented graphically as


follows.

Finite Impulse Response Filters


Finite impulse response (FIR) filters are digital filters whose impulse
response is finite. FIR filters are also known as nonrecursive filters,
convolution filters, or moving-average (MA) filters because you can
express the output of an FIR filter as a finite convolution

n–1
yi = ∑ hk xi – k (3-4)
k=0

where X represents the input sequence to be filtered, Y represents the


output filtered sequence, and H represents the FIR filter coefficients.

The following list gives the most important characteristics of FIR


filters.
• They can achieve linear phase due to filter coefficient symmetry in
the realization.
• They are always stable.
• You can perform the filtering function using the convolution and,
as such, a delay is generally associated with the output sequence
n–1
delay = ------------
2
where n is the number of FIR filter coefficients.

Digital Filter Design Toolkit Reference 3-4 © National Instruments Corporation


Chapter 3 IIR and FIR Implementation

You design FIR filters by approximating a specified desired frequency


response of a discrete-time system. The most common techniques
approximate the desired magnitude response while maintaining a linear
phase response.

Format of the Filter Coefficient Text Files


When you save your filter coefficients to a text file, the DFD
application generates a readable text file containing all the information
you need to implement the designed FIR or IIR digitial filter. This
section details the format for both FIR and IIR filter coefficient files.

FIR Coefficient File Format


An example FIR coefficient text file and description is given in the
following table:

coefficient file example description


FIR Filter Coefficients type of file
Sampling Rate sampling rate label
8.000000E+3 sampling rate in Hz
N filter order label
22 filter order
h[0..21] coefficients label
6.350871E-3 1st coefficient, h[o]
-8.833535E-3 2nd coefficient, h[1]
-2.847674E-2 .
4.626607E-2 .
4.103986E-2 .
-1.114579E-1
-1.412791E-2
1.810791E-1
-5.984635E-2
-2.002337E-1

© National Instruments Corporation 3-5 Digital Filter Design Toolkit Reference


Chapter 3 IIR and FIR Implementation

coefficient file example description


1.516199E-1
1.516199E-1
-2.002337E-1
-5.984635E-2
1.810791E-1
-1.412791E-2
-1.114579E-1
4.103986E-2
4.626607E-2 .
-2.847674E-2 .
-8.833535E-3 .
6.350871E-3 last coefficient, h[N-1]

You can implement the FIR filter using equation 3-4 directly.

IIR Coefficient File Format


IIR coefficient files are slightly more complex than FIR coefficient
files. IIR filters are usually described by two sets of coefficients, a and
b coefficients. There are a total of M * S a coefficients and (M+1)*S b
coefficients, where M is the stage order (usually 2) and S is the number
of stages. An IIR filter with three second-order stages has two a
coefficients per stage for a total of six a coefficients, and three b
coefficients per stage for a total of nine b coefficients.

An example IIR coefficient text file and description is given in the


following table:

coefficient file example description


IIR Filter Coefficients coefficient type
Sampling Rate sampling rate label
8.000000E+3 sampling rate in Hz
Stage Order stage order label

Digital Filter Design Toolkit Reference 3-6 © National Instruments Corporation


Chapter 3 IIR and FIR Implementation

coefficient file example description


2 order of each stage
Number of Stages number of stages label
3 number of stages
a Coefficients a coefficients label
6 number of a coefficients
3.801467E-1 a1 for stage 1
8.754090E-1 a2 for stage 1
-1.021050E-1 a1 for stage 2
9.492741E-1 a2 for stage 2
8.460304E-1 a1 for stage 3
9.540986E-1 a2 for stage 3
b Coefficients b coefficients label
9 number of b coefficients
1.514603E-2 b0 for stage 1
0.000000E+0 b1 for stage 1
1.514603E-2 b2 for stage 1
1.000000E+0 b0 for stage 2
6.618322E-1 b1 for stage 2
1.000000E+0 b2 for stage 2
1.000000E+0 b0 for stage 3
1.276187E+0 b1 for stage 3
1.000000E+0 b2 for stage 3

You can implement the IIR filter in cascade stages by using equation
3-1 (maintaining two past inputs and two past outputs for each stage),
or by using the direct form II equations (maintaining two past internal
states).

© National Instruments Corporation 3-7 Digital Filter Design Toolkit Reference


Chapter
Using Your Coefficient Designs:
DFD Utilities 4
This chapter contains a description of the DFD Utilities that you use for
LabVIEW, LabWindows/CVI, and Windows filtering applications.

LabVIEW DFD Utilities


This section contains descriptions of the DFD utilities that you can use
from within your LabVIEW applications to read DFD filter coefficient
files and to filter your data using the coefficients.

There are two DFD utility VIs, Read DFD Coefficients and DFD Filter.
To use these VIs, connect the file path of your coefficient file to Read
DFD Coefficients. The output Coefficient Cluster is then connected to
DFD Filter, along with your input signal. Once this sequence is
followed and the VIs have executed, your filtered data will be available
at the DFD Filter output Filtered X.

Read DFD Coefficients


The following VI reads the Digital Filter Design (DFD) filter
coefficient files and returns the coefficient data in a DFD coefficient
cluster. You can use the DFD Filter VI to filter your signals using the
DFD coefficient.

coefficient file path is the LabVIEW path to the DFD coefficient file.
This file can either be in log or text file format. If coefficient file path
is empty, you will be able to select a coefficient file from an open file
dialog.

Coefficient Cluster is the cluster of coefficient information read from


the coefficient file. The Coefficient Cluster is composed of the
following.

© National Instruments Corporation 4-1 Digital Filter Design Toolkit Reference


Chapter 4 Using Your Coefficient Designs: DFD Utilities

coefficient type: either 0 (IIR) or 1 (FIR)


sampling rate: sampling rate in Hz
IIR Filter Cluster: cascade IIR Filter Cluster
h(n): FIR filter coefficients

new file path is the file path to the coefficient file read. If coefficient
file path was empty, then the new file path contains the path to the file
selected from the open file dialog.

file error is set to true if an error occurred while reading or interpreting


the coefficient file.

DFD Filter
The DFD Filter VI filters the input array X using the Digital Filter
Design (DFD) coefficient cluster. You should use the Read DFD
Coefficients VI to read your DFD coefficient files and properly
initialize the input Coefficient Cluster.

X contains the array of input samples to filter.

Coefficient Cluster is composed of the following.

coefficient type: either 0(IIR) or 1(FIR)


sampling rate: sampling rate in Hz
IIR Filter Cluster: cascade IIR Filter Cluster
h(n): FIR filter coefficients

init/cont (init:F) controls the initialization of the internal filter states.


When init/cont (init:F) is FALSE (default), the internal states are
initialized to zero. When init/cont (init:F) is TRUE, the internal filter
states are initialized to the final filter states from the previous call to
this instance of this VI. To filter a large data sequence that has been
split into smaller blocks, set this control to FALSE for the first block,
and to TRUE for continuous filtering of all remaining blocks.

Filtered X is the array of filtered output samples.

Digital Filter Design Toolkit Reference 4-2 © National Instruments Corporation


Chapter 4 Using Your Coefficient Designs: DFD Utilities

error is the error code returned from the filtering VIs. You can wire
this output to the Find First Error VI to produce an error cluster. This
cluster can then be wired to the Simple Error Handler VI or the General
Error Handler VI for an immediate report on any errors. You can also
look up error codes in the Error Codes Appendix in the LabVIEW
Cross Reference Manual.

LabWindows/CVI Utilities
This section contains descriptions of the DFD utilities that you can use
from within your LabWindows/CVI applications to read DFD filter
coefficient files and to filter your data using the coefficients.

The DFD Instrument Driver


The Digital Filter Design Toolkit provides a LabWindows/CVI
instrument driver file called DFDUTILS.FP. This file can be found in
the path DFDUTILS\CVISRC\INSTR of your installation directory.

The DFD utility functions contained in the instrument driver


DFDUTILS.FP use a filter coefficient structure that holds the filter
coefficients. Here is a listing of header file DFDUTILS.H which
contains this filter structure as well as the four DFD utility function
prototypes.

#define intnum long


#define floatnum double
typedef struct {
intnum type;/* type of filter (lp,hp,bp,bs) */
intnum order;/* order of filter */
intnum reset;/* 0 - don’t reset, 1 - reset */
intnumn a;/* number of a coefficients */
floatnum *a;/* pointer to a coefficients */
intnum nb;/* number of b coefficients */
floatnum *b;/* pointer to b coefficients */
intnum ns;/* number of internal states */
floatnum *s;/*pntr to internal state array */
}FilterStruct, *FilterPtr;
FilterPtr AllocCoeffDFD (void);
long ReadCoeffDFD (char coeffPath[],FilterPtr
filterCoefficients, double *samplingrate);
long FreeCoeffDFD (FilterPtr filterCoefficients);

© National Instruments Corporation 4-3 Digital Filter Design Toolkit Reference


Chapter 4 Using Your Coefficient Designs: DFD Utilities

long FilterDFD (double inputArray[], long n, FilterPtr


filterCoefficients, double outputArray[]);

AllocCoeffDFD
FilterPtr fptr = AllocCoeffDFD (void);

Use AllocCoeffDFD to allocate and clear the DFD filter coefficient


structure. You must always call this once to properly allocate the DFD
filter coefficient structure.

Return Value

fptr FilterPtr pointer to allocated filter structure

Digital Filter Design Toolkit Reference 4-4 © National Instruments Corporation


Chapter 4 Using Your Coefficient Designs: DFD Utilities

ReadCoeffDFD
long err = ReadCoeffDFD (char coeffPath[],
FilterPtr filterCoefficients, double *samplingRate);

Use ReadCoeffDFD to read your DFD filter coefficient file. You must
always call AllocCoeffDFD once before calling this function.

Parameters

Input coeffPath character array pathname of DFD


coefficient file

Output filterCoefficients FilterPtr pointer to filter


coefficient structure

samplingRate double pointer to sampling


rate

Return Value

err long integer error code

FreeCoeffDFD
long err = long FreeCoeffDFD (FilterPtr filterCoefficients);

Use FreeCoeffDFD to free the DFD filter coefficient structure and all
of its coefficient arrays.

Parameters

Input filterCoefficients FilterPtr pointer to filter


coefficient structure

Return Value

err long integer error code

© National Instruments Corporation 4-5 Digital Filter Design Toolkit Reference


Chapter 4 Using Your Coefficient Designs: DFD Utilities

FilterDFD
long err = FilterDFD (double inputArray[], long n,
FilterPtr filterCoefficients, double outputArray[]);

Use FilterDFD to filter the input samples using the DFD filter coefficients.
You must always call AllocCoeffDFD and ReadCoeffDFD once before
calling this function.

This function can be used to filter blocks of one continuous sequence


of input samples. The input state of the filter is maintained using the
DFD filter coefficient structure. The number of output samples will
always equal the number of input samples (n).

Parameters

Input inputArray double array input array of


unfiltered samples

n long integer number of elements


in input array

filterCoefficients FilterPtr pointer to filter


coefficient structure

Output outputArray double array output array of


filtered samples
which must be at
least as large as
inputArray

Return Value

err long integer error code

Using the DFD Instrument Driver


Add the DFDUTILS.FP to your project and DFDUTILS.H to your
source code. Now you can call the DFD utility functions in your C
code. An example called DFDXMPL.PRJ under subdirectory of
DFDUTILS\CVISRC\EXAMPLE shows you how to call the DFD
utility functions.

Digital Filter Design Toolkit Reference 4-6 © National Instruments Corporation


Chapter 4 Using Your Coefficient Designs: DFD Utilities

Windows DLL DFD Utilities


This section contains descriptions of the DFD utilities that you can use
from within your LabWindows/CVI applications to read DFD filter
coefficient files and to filter your data using the coefficients.

The Digital Filter Design Toolkit provides a 16-bit DLL called


DFD16.DLL and a 32-bit DLL called DFD32.DLL for Windows’
users. These two DLLs are located in the subdirectory
DFDUTILS\WINSRC\WINDLL of your installation directory.

The function prototypes in the DFD DLL are:

FilterPtr FAR PASCAL AllocCoeffDFD (void);


long FAR PASCAL ReadCoeffDFD (char
coeffPath[],FilterPtr filterCoefficients,
double *samplingrate);
long FAR PASCAL FreeCoeffDFD (FilterPtr
filterCoefficients);
long FAR PASCAL FilterDFD (double inputArray[],
long n, FilterPtr filterCoefficients,
double outputArray[]);

See the descriptions for each function and its parameters in the
previous section LabWindows/CVI Utilities . Call these functions the
same way in your code as you call other DLL functions.

The Digital Filter Design Toolkit also provides an example for Visual
Basic 3.0 showing you how to call the DFD utility functions. The
source code is located under the subdirectory
DFDUTILS\WINSRC\EXAMPLE\VB of your installation directory.

Before you run the Visual Basic example, copy DFD16.DLL to your
Windows directory.

© National Instruments Corporation 4-7 Digital Filter Design Toolkit Reference


Appendix

References A
This appendix lists the reference material used to produce the Digital Filter
Design Toolkit. For more information about the theories and algorithms
implemented in the Digital Filter Design Toolkit, refer to the following
documents.
1. A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal
Processing, Englewood Cliffs, NJ: Prentice-Hall, 1989
2. T. W. Parks and C. S. Burrus, Digital Filter Design, John Wiley &
Sons, Inc., 1987
3. L. B. Jackson, Digital Filters and Signal Processing, Boston:
Kluwer, 1986
4. A. B. Williams and F. J. Taylor, Electronic Filter Design
Handbook, New York: McGraw-Hill, 1988
5. T. W. Parks and J. H. McClellan, “Chebyshev Approximation for
Nonrecursive Digital Filters with Linear Phase”, IEEE Trans.
Curcuit Theory, Vol. CT-19, pp 189-194, Mar. 1972a
6. T. W. Parks and J. H. McClellan, “A Program for the Design of
Linear Phase Finite Impulse Response Filters”, IEEE Trans. Audio
Electroacoustics, Vol. AU-20, No. 3, pp.195-199, Aug. 1972a

© National Instruments Corporation A-1 Digital Filter Design Toolkit Reference


Appendix

Customer Communication B
For your convenience, this appendix contains forms to help you gather the information necessary
to help us solve your technical problems and a form you can use to comment on the product
documentation. When you contact us, we need the information on the Technical Support Form
and the configuration form, if your manual contains one, about your system configuration to
answer your questions as quickly as possible.

National Instruments has technical assistance through electronic, fax, and telephone systems to
quickly provide the information you need. Our electronic services include a bulletin board
service, an FTP site, a FaxBack system, and e-mail support. If you have a hardware or software
problem, first try the electronic support systems. If the information available on these systems
does not answer your questions, we offer fax and telephone support through our technical support
centers, which are staffed by applications engineers.

Electronic Services

Bulletin Board Support


National Instruments has BBS and FTP sites dedicated for 24-hour support with a collection of
files and documents to answer most common customer questions. From these sites, you can also
download the latest instrument drivers, updates, and example programs. For recorded
instructions on how to use the bulletin board and FTP services and for BBS automated
information, call (512) 795-6990. You can access these services at:
United States: (512) 794-5422 or (800) 327-3077
Up to 14,400 baud, 8 data bits, 1 stop bit, no parity
United Kingdom: 01635 551422
Up to 9,600 baud, 8 data bits, 1 stop bit, no parity
France: 1 48 65 15 59
Up to 9,600 baud, 8 data bits, 1 stop bit, no parity

FTP Support
To access our FTP site, log on to our Internet host, ftp.natinst.com, as anonymous and use
your Internet address, such as joesmith@anywhere.com, as your password. The support files
and documents are located in the /support directories.

© National Instruments Corporation B-1 Digital Filter Design Toolkit Reference


FaxBack Support

FaxBack is a 24-hour information retrieval system containing a library of documents on a wide


range of technical information. You can access FaxBack from a touch-tone telephone at the
following numbers:
(512) 418-1111 or (800) 329-7177

E-Mail Support (currently U.S. only)


You can submit technical support questions to the appropriate applications engineering team
through e-mail at the Internet addresses listed below. Remember to include your name, address,
and phone number so we can contact you with solutions and suggestions.
GPIB: gpib.support@natinst.com
DAQ: daq.support@natinst.com
VXI: vxi.support@natinst.com
LabVIEW: lv.support@natinst.com
LabWindows: lw.support@natinst.com
HiQ: hiq.support@natinst.com

Fax and Telephone Support


National Instruments has branch offices all over the world. Use the list below to find the
technical support number for your country. If there is no National Instruments office in your
country, contact the source from which you purchased your software to obtain support.

Fax Telephone
Australia 03 9 879 9422 03 9 879 9179
Austria 0662 45 79 90 0 0662 45 79 90 19
Belgium 02 757 00 20 02 757 03 11
Canada (Ontario) 519 622 9310 519 622 9311
Canada (Quebec) 514 694 8521 514 694 4399
Denmark 45 76 26 00 45 76 71 11
Finland 90 527 2321 90 502 2930
France 1 48 14 24 24 1 48 14 24 14
Germany 089 741 31 30 089 714 60 35
Hong Kong 2645 3186 2686 8505
Italy 02 48301892 02 48301915
Japan 03 5472 2970 03 5472 2977
Korea 02 596 7456 02 596 7455
Mexico 5 202 2544 5 520 3282
Netherlands 03480 33466 03480 30673
Norway 32 84 84 00 32 84 86 00
Singapore 2265886 2265887
Spain 91 640 0085 91 640 0533
Sweden 08 730 49 70 08 730 43 70
Switzerland 056 20 51 51 056 20 51 55
Taiwan 02 377 1200 02 737 4644
U.K. 01635 523545 01635 523154
Technical Support Form
Photocopy this form and update it each time you make changes to your software or hardware, and
use the completed copy of this form as a reference for your current configuration. Completing
this form accurately before contacting National Instruments for technical support helps our
applications engineers answer your questions more efficiently.
If you are using any National Instruments hardware or software products related to this problem,
include the configuration forms from their user manuals. Include additional pages if necessary.
Name _________________________________________________________________________
Company ______________________________________________________________________
Address _______________________________________________________________________
______________________________________________________________________________
Fax (___ )___________________ Phone (___ ) ______________________________________
Computer brand ________________ Model ________________ Processor __________________
Operating system (include version number) ___________________________________________
Clock speed ______MHz RAM _____MB Display adapter _________________________
Mouse ___yes ___no Other adapters installed ______________________________________
Hard disk capacity _____MB Brand ____________________________________________
Instruments used ________________________________________________________________
______________________________________________________________________________
National Instruments hardware product model __________ Revision_______________________
Configuration___________________________________________________________________
National Instruments software product ___________________________ Version_____________
Configuration___________________________________________________________________
The problem is: _________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
List any error messages: __________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
The following steps reproduce the problem: ___________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Documentation Comment Form
National Instruments encourages you to comment on the documentation supplied with our
products. This information helps us provide quality products to meet your needs.
Title: Digital Filter Design Toolkit Reference
Edition Date: August 1995
Part Number: 320953A-01

Please comment on the completeness, clarity, and organization of the manual.


______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

If you find errors in the manual, please record the page numbers and describe the errors.
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Thank you for your help.


Name _________________________________________________________________________
Title __________________________________________________________________________
Company ______________________________________________________________________
Address _______________________________________________________________________
______________________________________________________________________________
Phone ( ) ____________________________________________________________________

Mail to: Technical Publications Fax to: Technical Publications


National Instruments Corporation National Instruments Corporation
6504 Bridge Point Parkway, MS 53-02 MS 53-02
Austin, TX 78730-5039 (512) 794-5678
Glossary

Prefix Meaning Value

m- milli- 10-3

µ- micro- 10-6

n- nano- 10-9

Numbers
1D One-dimensional.

2D Two-dimensional.

A
ASCII American Standard Code for Information Interchange.

D
DAQ Data acquisition.

datalog file A file for saving LabVIEW data in binary format.


DFD Digital Filter Design

DFT Discrete Fourier transform.

F
FFT Fast Fourier transform.

FIR Finite Impulse Response

frame A segment of time domain data.

© National Instruments Corporation G-1 Digital Filter Design Toolkit Reference


Glossary

I
IIR Infinite Impulse Response.

M
MB Megabytes of memory.

N
Nyquist Rate Half the sampling rate.

O
oversampling rate The ratio between the number of Gabor coefficients and the
number of test samples.

S
sampling rate The rate at which a continuous waveform is digitized.

spectral changes Changes in the frequency content of a signal.

V
VI Virtual instrument.

Digital Filter Design Toolkit Reference G-2 © National Instruments Corporation

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy