PoZeTools logo

PoZeTools

version 0.56, december 24, 2019
© 2002 - 2019 - Pieter Suurmond

PoZeTools is free software for digital filter design.
Given a set of poles and zeros, it plots the frequency response, calculates filter coefficients, plots the impulse response and prints the linear difference equation.
The software is written in ISO/ANSI C. Sourcecode and documentation may be downloaded, used and copied for free. It should compile and run well on Linux, BSD, Mac OSX, IRIX, etc. The commandline tool should even still work on Mac OS7-9.
PoZeTools comes with 2 different user interfaces:

  1. Commandline tool  PZT
  2. CGI webinterface  nph-PZT.cgi

Both programs offer the same functionality and use exactly the same input syntax (poze.ebnf).


PZT

Console application PZT requires no input paramers. Instead, it tries to read-in a textfile named x.poze, in the current directory, containing a number of pole- and zero-locations and an optional gain. When it succeeds, it generates 4 JPEG files, also in the current directory.
So first edit or create input-file x.poze and then run the commandline executable by typing:

        ./PZT

In the first image generated, the given poles and zeros are plotted in the complex z-plane, it may look something like this:

example 1

In the second image, the transfer function is drawn, on a linear frequency scale. It contains magnitude-, angle-, and a time-delay-plots. Here 's an example:

example 2

The third image shows an overview, containing the complex z-plane and the transfer function on a logarithmic frequency scale. It may look something like this:

example 3

The fourth image displays the conversion to the time domain: filter coefficients are calculated and the impulse response is plotted:

   a(0) = 0.037643100555    b(0) =  1.000000000000
   a(1) = 0.101302601065    b(1) = -0.833870873723
   a(2) = 0.179943012472    b(2) =  0.711395491187
   a(3) = 0.212529635999
   a(4) = 0.180502995174
   a(5) = 0.105815572045
   a(6) = 0.037145890166
 
   Difference equation:
 
    y[n] -0.83 y[n-1] + 0.71 y[n-2] = 0.04 x[n] + 0.1 x[n-1] + 0.18 x[n-2]
                                    + 0.21 x[n-3] + 0.18 x[n-4]
                                    + 0.11 x[n-5] + 0.04 x[n-6]

example 4



nph-PZT.cgi

CGI application nph-PZT.cgi generates HTML-forms in which the webclient can fill in her poles, zeros and gain, using exactly the same poze syntax as the console application. The web application displays two JPEG images: one for the frequency domain (nph-freq.cgi.jpg) and one for the time domain (nph-time.cgi.jpg). It furthermore shows the filter coefficients and the difference equation (with downrounded coefficients).
So, whereas the console application reads-in a textfile with pole-zero locations and outputs 3 image files, the CGI application reads the pole-zero locations from a web client and returns 2 images.

The CGI application runs on server ecomaan.nl: Here you can design your own LTI filters for free: https://ecomaan.nl/cgi-bin/pzt/nph-PZT.cgi

To install your own CGI service, type "make cgi" and copy the 3 resulting executables cgi/nph-PZT.cgi, cgi/nph-freq.cgi.jpg and cgi/nph-time.cgi.jpg to a new subdirectory in your public_html/cgi-bin. When nph-PZT.cgi is accessed for the first time, it will create the necessary datafiles automatically. Make sure the CGI application is able to create and remove files in its' own directory.


Source code

The latest version of PoZeTools may be found under https://ecomaan.nl/c/.

  download PoZeTools as gzipped tar-file  PoZeTools0.56.tar.gz  358 kilobytes  Complete sources and documentation, version 0.56, tarred and gzipped.
 
After downloading, one may unpack on the commandline by for example:
        gunzip PoZeTools0.56.tar.gz
        tar xf PoZeTools0.56.tar
        gzip PoZeTools0.56.tar
        cd PoZeTools0.56
        ls -als
After unpacking, directory PoZeTools0.56 should look something like this:

  subdirectory  cgi/ subdirectory  PoZeTools CGI interface. A webinterface that possibly enables any websurfer to do the same things as with the console application. Tested on the Apache webserver.
  subdirectory  gt/ subdirectory  Minimal graphic toolkit for drawing and writing (not reading) JPG-files. Incorporates the compression-part of the JPEG-library from the Independent JPEG Group (version 6b, 27-Mar-1998). Also include source gt/gt.c in your compiler project.
  UNIX Makefile  Makefile  4 579 bytes  Helpfull to compile PoZeTools and under UNIX.
Users with a graphical compiler (IDE) may simply drop all the .c files mentioned here in a standard C project. Also link against the math library.
  PoZeTools input syntax  poze.ebnf  5155 bytes   Formal description of the input syntax.
  ANSI C source  PZT.c 5 5527 bytes   Contains main() for the console application.
  ANSI C header  PZT.h 35 bytes   Headerfile containing the version number used for all applications.
  ANSI C header  PZT_coeff.h 3 3581 bytes   API headerfile specifying how to manage COEFF objects.
  ANSI C source  PZT_coeff.c 15 984 bytes   Implements the creation and destruction of COEFF objects, reading and writing of COEFF data as text(files), computation of COEFF objects out of POZE objects.
  ANSI C header  PZT_coeff_graph.h 2 075 bytes   API headerfile specifying COEFF drawing functions.
  ANSI C source  PZT_coeff_graph.c 14 169 bytes   Implements impulse response plotter.
  ANSI C header  PZT_complex_math.h 4 051 bytes   API headerfile for complex arithmetic in C.
  ANSI C source  PZT_complex_math.c 3 489 bytes   Implements complex arithmetic.
  ANSI C header  PZT_complex_text.h 4 051 bytes   API headerfile for parsing and writing text.
  ANSI C source  PZT_complex_text.c 11 484 bytes   Implements reading and writing of complex numbers (in both polar and rectangular form) from and to strings, files, and the console (stdout).
  ANSI C header  PZT_graph.h 2 559 bytes   Headerfile.
  ANSI C source  PZT_graph.c 6 528 bytes   Common drawing functions.
  ANSI C header  PZT_poze.h 7 188 bytes   API headerfile specifying how to manage POZE objects.
  ANSI C source  PZT_poze.c 18 832 bytes   Implementation that reads and writes sets of poles and zeros (and a gain parameter).
  ANSI C header  PZT_poze_graph.h 3 160 bytes   API headerfile specifying POZE drawing functions.
  ANSI C source  PZT_poze_graph.c 35 202 bytes   Implements plotting of z-planes and frequency responses.
  subdirectory  html subdirectory  Subdirectory containing this very HTML documentation.
  Textfile in 'poze' format  x.poze 1 046 bytes   Example input file.
 
To compile both the commandline-tool and the CGI-interface, type:
        make all
To compile only the commandline-tool, type:
        make

License

Besides the PoZeTools license, which is printed below, there may be other licenses of interest within this software package (see subdirectory gt).

  PoZeTools version 0.56, december 24, 2019.
Latest version available at:  https://ecomaan.nl/c/.

Copyright © 2002-2019 Pieter Suurmond

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

Any person wishing to distribute modifications to the Software is requested to send the modifications
to the original developer so that they can be incorporated into the canonical version.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.


Thanks

Tom Lane and others of the Independant Joint Picture Expert group for the open source distribution of JPEG library 6b (27-Mar-1998).
Maarten de Boer and Eduard Aylon for debugging and testing.
Arie van Schutterhoef for the PoZeTools icons.
Sam Roig Torrubiano for starting the formal description of the input syntax in EBNF.