Skip to main content
Best answer by -MFra-

Attached is the version with corrections.

3 replies

ttokoro
21-Topaz I
21-Topaz I
October 20, 2022

image.png

t.t.
25-Diamond I
October 20, 2022

@-MFra- wrote:

Hi!

Why, in figure 29 of the attached worksheet, do the phases not coincide?


Because its wrong to just use "atan (Im(z)/Re(z))" to get the phase for any complex number z. To get the correct result you'll have to add or subtract pi if Re(z)<0!

Adding pi gives you the phase in the range ]-pi/2; 3 pi /2] and looks like this:

Werner_E_2-1666260841247.png

Subtracting pi forces the phase to ]-3 pi /2; pi/2)

Werner_E_3-1666260959016.png

 

You may use "atan2" instead of "atan" in your function phi to get the very same results as you get with "arg", that is a phase in }-pi; pi]

Using atan2 also has the advantage that the case of Re(z)=0 is handled correctly and does not throw an error!

Werner_E_4-1666261115623.png

 

Of course "arg" would do the job equally well 😉

Werner_E_1-1666260498995.png

 

BTW, to avoid jump discontinuities in the phase plot you can use the "phasecor( )" function  but you have to turn the continuos function into vectors for plotting.

 

 

-MFra-21-Topaz IIAuthor
21-Topaz II
October 20, 2022

Right, we talked about it a while ago, but I had just forgotten it. Thank you.

-MFra-21-Topaz IIAuthorAnswer
21-Topaz II
October 20, 2022

Attached is the version with corrections.