(

Author: Paul Mennen

Email: paul@mennen.org

To get much benefit from this application, you will need at least a rudimentary understanding transfer functions and its depiction in the z-plane. There are hundreds of books that can help you with that, but if you are a beginner in this area, one recommendation I can make is

Note that the numerator polynomial is 5th order and the denominator polynomial is 4th order so there will be 5 zeros and 4 poles. (Two of those zeros and two of those poles are below the x-axis, and so they are not shown on the pole/zero plot.) There isn't anything particularly special about this transfer function ... it was just chosen so that you will have something more interesting to start with than a flat transfer function. After the first time, editz will start up showing the transfer function that was in effect the last time you pressed the "save" button.

This is the figure window you will see after starting editz with the above default transfer function:

Try clicking on any root.

Notice that a diamond shape marker appears on top of the root indicating that you can now move this root to a new location by dragging it with the mouse. Observe that while you are dragging the root to a new location the top plot is being continuously updated to reflect the transfer function magnitude and phase associated with the pole/zero plot. (This is the signature feature of editz.) When you release the mouse button, the diamond marker will disappear, but will reappear as soon as you click on another root that you wish to move. Note that when you are moving a root, you are actually moving a pair of roots (complex conjugate pairs) unless the root is on the x axis. This insures that the polynomial coefficients are always real.

Often when you are moving a zero, you may want to place the zero on the unit circle since this results in a symmetric numerator polynomial. To make this easier, there is a "

Likewise, when you are moving either a zero or a pole, often you will want to place it on the real axis. To make this easier, as you move the root inside the green tolerance band along the X axis, the root will snap to the real axis. Note that as you snap a root onto the real axis, the number of coefficients in the corresponding polynomial will decrease by one since the root no longer has a corresponding complex conjugate location. (You will also see the number of zeros or poles change in the TraceID box just to the left of the Yaxis label.) Note that as you are moving the root, the x/y cursor readout shows the real and imaginary components of the root respectively and the polar representation (i.e. magnitude/phase) is shown in parenthesis to the right of the x cursor readout -

To add a new pole or zero, click on the "

As mentioned in the previous section, when you click on one of the coefficients in the coefficient strip, that coefficient will increase or decrease by .001. But that is only the default. Suppose instead you want the coefficients to change by .0001 instead. To do that, left or right click on the "

It is sometimes desirable to keep the numerator polynomial symmetric (i.e. it reads the same left to right or right to left). This keeps all the zeros on the unit circle or in pairs at distances r and 1/r. To insure that the numerator remains symmetric as you increment or decrement a numerator coefficient, put a check in the "

At the bottom of this group is the "

in = ones(1,40);

step = filter(pn,pd,in);

plt(step);

Or to produce a step response using vertical bars, replace the last line with this slightly more complex plt command:

plt(Pvbar(in,0,step),

'title','step response');

Or you could plot the group delay with a command such as this:

plt((0:511)/1024,grpdelay(pn,pd),'title','group delay');

Note that this command will only work if you have the signal processing toolbox since the grpdelay function is defined in that toolbox.

Although you could compute the zeros and poles from the numerator and denominator polynomials for convenience they are also copied to the base workspace using the variable names z and p respectively. (Only the roots in the upper half plane are included.) Here is an example of using the z workspace variable:

Although editz provides a way to quantize the polynomial coefficients it doesn't provide a way to quantize root locations. Suppose after editing the numerator polynomial in the coefficient strip you wanted to move the zeros to the nearest multiple of 5 degrees. Running the following script from the command window would perform that function:

plt xleft EDIT 5; % exit data editing mode [t r] = cart2pol(real(z),imag(z)); % convert zeros to polar (theta,rho) c = 36/pi; [x y] = pol2cart(round(c*t)/c,r); % round angle to nearest 5 degrees h = getappdata(gcf,'Lhandles'); % list of lines [Mag Phase Zeros Poles Circle] set(h(3),'x',x,'y',y); % save quantized data to the zeros line a = get(gcf,'ResizeFcn'); feval(a{1}); % update the frequency response plotNote that the z workspace variable is used to retrieved the current zero locations but it is not sufficient to mearly modify that variable. You actually have to modify the line data so that the plot gets updated. Also without the last line, the frequency response plot would not reflect the new locations of the zeros.

After using editz for a while, most people guess that an application like this would involve thousands of lines of code. So you may be surprised to learn that editz.m consists of only about 200 lines of code. The main reason the code is so small is that it uses the plt toolbox which includes many features needed to create interesting plotting based graphical interfaces.

If your questions are not answered by reading the help documentation, don't hesitate to contact the author. My email address appears at the top of this document and can also be found at the top any of the included .m files.

Paul Mennen