Language: Python
Processor: Not Relevant
Submitted by Christopher Felton on Dec 17 2011
Licensed under a Creative Commons Attribution 3.0 Unported License
Python is a popular general purpose programming language with powerful numerical and scientific packages, numpy and scipy. The Python ecosystem also has a impressive plotting package, matplotlib. The language and packages (the Python ecosystem) creates an ideal computing platform for Science and Engineering analysis and design.
But the current distributions does not include a zplane function which many DSP'ers might use because it is availabe in other packages Matlab, Octave, etc. Below is a function to implement similar behavior to the common used zplane function.
The zplane function takes the numerator and denominator polynomial representation of a transfer function and plots the complex z-plane poles and zeros.
For those unfamiliar with a numerical computing package, polynomials are usually represented least order coefficient to the highest order coefficient. An array assignment might look like the following, where *N* is the polynomial order.
The function below will plot a complex zplane given an array of b and a coefficients, numerator and denominator respectively.
This code requires the following packages:
Example usage:
>>> import numpy as np
# If the code is in a file called plot_zplane.py
>>> from plot_zplane import zplane
>>> b = np.array([0, 1, 1])
>>> a = np.array([1, 1/4., -3/8.])
>>> zplane(b,a)

posted by Christopher Felton