# Discontinuity in the angle of a complex exponential signal

Plotting this complex expontential:

$$z[n]=100e^{j0.1n},\quad\text{we have a discontinuity at}\quad \arg[n]=10\pi$$ I guess this is related to the angle formula:

$$\theta=\arctan\left(\frac{\Im\{z[n]\}}{\Re\{z[n]\}}\right)$$

But I do not quite see the relationship. Can anyone tell me exactly why we have a discontinuity at $10\pi$?

• @Jazzmaniac, I would suggest that you put this as an answer to be able to close the question gracefully. Freeman, in addition to what jazzmaniac says: a) Take a look at the phase values that this "discontinuity" seems to be hapenning at and also b) you may want to have a look at this link (for the technique, similar functions are available in other packages as well).
– A_A
Oct 25, 2016 at 9:47
• @A_A agreed and done! Oct 25, 2016 at 9:51
• Take a look at the unwrap function in Matlab/Octave, and try plotting your arg{z[n]} unwrapped. That might be more what you are expecting (i.e. no discontinuity in the plot due to unwrapped phase). Oct 25, 2016 at 18:24

Angular calculations for complex analysis are performed by atan2. it is called "four-quadrant inverse tangent" the phase of a complex number z is simply atan2(imag(z),real(z)).

It is different form atan since it checks the signs of both real and imaginary parts to correctly separate the arcs with equal $\tan$ located in opposite quarters. The range of atan2 is $[-\pi, \pi]$. More clearly, it is in the range $[0,+\pi]$ when the the given z is in Q1 and Q2 and is between $[-\pi,0]$, when z is in Q3 and Q4.

When you evaluate $e^{j0.1n}$ at $n=10\pi-\epsilon$ (for $\epsilon>0$), you are in Q2. Hence, atan2 gives you $+\pi$. But as soon as you pass Q2 and evaluate atan2 at $n=10\pi+\epsilon$ it is in Q3 and the result is $-\pi$. That is why there is a sudden change.

That's not really a discontinuity. On a circle the two points $-\pi$ and $+\pi$ are identified: They are the same point. That is true for all $x$ and $x+n 2\pi$ for integer $n$.

If you would like to keep the continuity obvious, you might want to switch to a phasor representation of angles. Those are complex numbers on the unit circle $\exp(i\phi)$ and they form a group under multiplication. They nicely absorb the non-obvious topology of the phase angle.

A complement to @Jazzmaniac.

The discontinuity is only apparent because of your interpretation: you plot an angle on a plane, with a $y$-axis (the one with interval $[-4,4]$) taking real values. A sounder representation (not easy in 2D) would be to take into account the $2\pi$ periodicity, and plotting the phase on a cylinder, whose axis is the $x$-axis.

Imagine you cut an horizontal stripe in your diagram at $y=\pi$ and $y=-\pi$. Then you fold it into an horizontal cylinder and put some scotch tape so that the borders $y=\pi$ and $y=-\pi$ are joined. If you do that, you will see that the top angle at coordinate $(10\pi-,\pi-)$ (the $-$ denotes a value taken slightly to the left) becomes close (on the cylinder surface) to the bottom angle at coordinate $(10\pi+,-\pi+)$ (the $+$ denotes a value taken slightly to the right).

This is because the natural topology of angles is that of a 1D torus: On the bottom square, the natural topology tells you that the two sides called B are far away. But if you fold and glue (top right cylinder), both so-called B-sides become indistinguishable in the torus geometry. And the same for the A-sides, giving you the torus on the top left.

So if you take the segment $[-\pi,\pi]$ is which the principal argument resides, apparently $-\pi$ and $\pi$ are far away in the real ($\mathbb{R}$) topology. But in the natural angle topology, you bend the segment $[-\pi,\pi]$ into a circle, and then $-\pi$ and $\pi$ become indistinguishable. So, $-\pi+0.001$ is very close to $\pi-0.001$.