DOC PREVIEW
Zlab: Explore the complex plane in Matlab

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Zlab: Explore the complex plane in MatlabRobert L. ParkerAseries of matlab scripts allows the user to generate informative views of an analytic function ofacomplex variable in the complex plane. The user provides the matlab formula for the func-tion, which can be displayed in various ways: magnitude-phase contour diagram, with singu-larities and branch cuts indicated; perspective views of the function magnitude, or its real andimaginary parts. Help scripts areprovided enabling the user to move around the plane, or tozoom in on interesting features, and to rotate any of the perspective plots. In addition, a pro-gram is provided for performing a contour integral numerically on a path specified by mouseover the plane.Zlab comprises a series of scripts and runs essentially as command-line language, with occasion-ally mouse input. The master routine is zlab which generates the function values and updatesthe contour map. All the other routines work on the values that zmap creates; some invokezmap to move the center of the graph window or investigate the z plane on a new scale.Hereisanexample of a run made with zlab.Ifyou type in these instructions using the top func-tion in the script fun.m provided various features of the complex plane will be illuminated. Thetop function is a hankel function.zmap % Plots a magnitude-phase contour plot of the Hankel function%The log branch cut and a simple zeroappearsolid % Aperspective fish-net plot is drawn of the same areaturn % The perspective figureisrotatedzooom % Move in, getting a closer view of the branch pointzooom % Move in furtherpan % Using the mouse, chose another center for the plot, say%the saddle point at 0.0575 - 0.0838ipullback % Reverse the last zooompullbackpullback % We can see a larger area, including morezeros.clear % Restoreall default settingsPrologAt first blush it may seem trivial to get matlab to contour up analytic function of a complex vari-able; why would anyone need a whole collection of special scripts? To dothe job right, how-ever,requires a great deal of attention to detail. For example, simply contouring the phase off(z) in a naive fashion leads to lots of jagged lines. Similarly,because most interesting functionshave singularities, or exponential growth, run-away maximum values makes elementary con-touring impractical: the peaks have to be suppressed to make surevital detail isn’t lost. Andthen thereis matlab’s baroque profusion of commands to get the axes labeled and the figurepro-portions right, and so on. Once sorted out, who wants to remember them all? Better to havethem safely tucked away in zlab..11 September 2009PSD 2These scripts operate on a set of variables that areall out in the common workspace. Thedefaults areinvoked unless the user explicitly sets them. For example, zmap will choose theorigin z=0 as the center of the main plot, and draw inside a squarewindow that is 6.3 units highand wide. When pan or zooom areused, these parameters arereset. The user can start the ploton a different center simply by setting the 2-vector center to the real and imaginary parts of thenew origin. The viewing window size is also set by a 2-vector, side which gives the x and ylengths of the viewing box.Command Catalogzmap:Draw a contour map centered at the origin in a squareregion 6.3 units high and wide ofthe analytic function of z defined in the function script fun.m.The map is drawn in figure1.Itis an magnitude map, indicated by color and black level lines; superimposed arewhite contoursof phase, spaced by 30 degrees. Indicated in yellow and red areestimates of the singularitiesand the branch cuts as positioned by matlab defaults. If the user wishes to displace the cuts, heor she may be able to trick the matlab algorithm. For example, to get the square-root cut to runup the imaginary axis write:y=(1-i)*sqrt(i*z/2);in fun.m.This may not be possible with morecomplicated functions like the Hankel function.The command zmap must be the first one issued beforeany of the others in the catalog can beused. If fun.m needs to be modified, a separate window should be opened, and the script editedthere, without having to stop matlab.solid:Infigure2,draw a fishnet altitude plot of the function magnitude |f(z)|inthe sameregion as the zmap graph. This command draws on arrays computed by zmap.Itcan beviewed from a variety of angles with the command turn.zview:Infigure3draw two altitude plots, one for the real part the other the imaginary part ofthe function f.turn:Rotate in 30 degree increments the most recently drawn altitude plot.zooom:Recompute and redraw the zmap magnitude-phase plot on a larger scale, with centerunaltered. The size of the viewing box is reduced by a factor of two-thirds by this commandThe native matlab command zoom still works, but it does not recompute the function, and so nomoredetail will be added as the viewer closes in on a featureofinterest.pullback:Reverse the effect of zooom.pan :Recompute and redraw the zmap plot centered on a new point that is within the currentviewing window.The new center is specified by double-clicking on the desired point. If thepointer is left in the viewing window,another center can be chosen without re-issuing the pancommand, so that the user can conveniently focus the center of interest again. This commandmodifies the 2-vector center.integrate:Perform a complex contour integration numerically over a path drawn on the zmapgraph with the mouse. The path may be closed, if the first and last points areclose together,oropen if the program decides they arefar apart. The instructions for mouse input areprinted tothe terminal and will not be repeated here.zlab:Ado-nothing script containg a comments that can be accessed by the matlab help system,as inhelp zlab11 September 2009PSD 3Moredetailed information on each command can also be found by entering the command namein the help call; for exmaplehelp integrateThe documentation that you arenow reading is the most extensive however.fun :This is not a zlab command, but a required function which zmap refers to in order to getthe complex function under investigation. An example of such a function might befunction y = fun(z)%Integrand of a simple Fourier transformy=exp(i*z) ./ (1 + z.ˆ2); returnThe calculations must be written to accept a complex matrix for the variable z and operationsmust not be those of linear algebra, but element-by-element. Thus, as shown in this example, zsquared must be written z .ˆ 2 not as zˆ2 which is matrix


Zlab: Explore the complex plane in Matlab

Download Zlab: Explore the complex plane in Matlab
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Zlab: Explore the complex plane in Matlab and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Zlab: Explore the complex plane in Matlab 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?