PEZ - Import Options
[ Intro Functionality Add/Delete Edit Import Export ]
<< Previous Next >>

Import Options

PeZ has a number of methods of communicating with the Matlab environment. This communication allows users to better prod the filter data as well as save the data for later use.

To get to the Import Options, select the Import Filter Data button from the main window:

graphics/pez_ie.gif
 
Selecting the Import Filter Data will set up a number of import options for the user to choose from. The default import option is to Import from Simple Data Values. There are currently four methods of importing: Data Values, File, [B,A]=, and Grab Filtdemo.
 
There is also a Matlab command line function for importing into pez.
 


 Importing Simple Data Values

The simplest way to add values is to give the filter array coefficients. The Import Values options appear as:
graphics/pez_impo.gif
 
 
 
  • Pole/Zero Values: These values are the coefficients for the filter.
            Note: These values may be regular Matlab expressions to an extent, for example, select roots and enter:
                Pole Values:   cos(linspace(-pi,pi,5))+j*sin(linspace(-pi,pi,5))
  • Poly refers to polynomials. This means you wish to enter the coefficients of the polynomial equation.
            Example:  5*x(n) + 3*x(n-1) + 1*x(n-2) ==> [5 3 1]
  • Roots refers to the roots of the polynomial. These are generally more accurate than polynomials.
            Example: x(n) - 3x(n-1) + 2x(n-2) = (x(z)-1)(x(z)-2) ==> [1 2]
 
 


Importing from File

The import from file option allows the user to load a Matlab file containing filter coefficients. Selecting this option sets the display to the following:
graphics/pez_ifil.gif
 
  • File: This button selects the Matlab (.mat) data file to extract the filter data from.
  • Pole/Zero Variable Name: These are the variable names used in the data file to store the filter.
  • Poly/Roots: These determine whether the filter data arrays are Polynomials or Roots. See above.
  • Filter Gain: Sets what the numerical gain of this filter is. Since any imports are seen as cascading of filters, this will have the effect of multiplying the overall gain of the filter.
  • Load from File: This executes the actual load. If there are problems, errors will appear in the Matlab window.
Note: Matlab 4.2 and Matlab 5.x data files are not the same! I believe you can load the 4.2 files with 5.0, but not vice versa.

Import [B,A]=

Since there are a number of filter commands in Matlab that return filter coefficients in the form of [B,A], PeZ can import the results right into the system. What PeZ does is make the call exactly as the user types it, and tries to import the result straight into PeZ. The display appears as:
graphics/pez_iba.gif
 

Example of what to place in the entry box:

[B,A] = butter( 5, 0.5, 'high' )

This will import a 5th order highpass Butterworth filter with cutoff at pi/2.


Grab Filtdemo

Probably one of the most interesting things about PeZ is that it can interact with other Matlab programs. There is a tool called 'filtdemo' that allows users to graphically create different types of filters based on response. Choosing the Grab Filtdemo in the import options of PeZ allows PeZ to examine Filtdemo and grab its current filter. This can all be done by:
 
  • Start Matlab
  • Start PeZ by typing pez
  • Start Filtdemo by typing filtdemo
  • Design a filter in filtdemo
  • Go to PeZ and select the Grab Filtdemo from the Import Options
  • Manipulate the filter in PeZ and see what happens when you good up the poles and zeros.
Currently there is no easy way to send the filter back to filtdemo, but then again, there's not much point.

 


Command Line Import

PeZ also allows users to import filter data through a Matlab command line program. The function is called pzimport and has the following format:
 
 
pzimport(B,A,GAIN,are_roots) 
B 
A 
GAIN 
are_roots
Zeros Coefficient Vector 
Poles Coefficient Vector 
This Filter's Gain 
0=B,A are Polynomials(Default) 
1=B,A are Roots
 
 
Examples:
 
>> pzimport(B,A) 
>> pzimport(B) 
>> pzimport(B,A,5) 
>> pzimport(B_root,A_root,8,1) 
Imports polynomials, gain of B(1) 
Imports polynomial Zero vector, gain of B(1) 
Imports polynomials with gain of 5(Ignores B(1)) 
Imports root vectors, gain of 8
 


[ Intro Functionality Add/Delete Edit Import Export ]
<< Previous Next >>