# Phase diagram of a rectangular pulse with Fourier Series - help understanding

I understand perfectly fine how to plot the magnitude of a Fourier series, but I'm having serious trouble understanding how to plot the phase spectrum. Below is a picture of a rectangular pulse. The magnitude diagram makes sense to me - but how did they determine the phase diagram?

I know that the coefficient is: $$a = \frac{Asin(n*pi/2)}{n(pi/2)}$$ or $$Asinc(n*pi/2)$$, but I'm not sure how to determine the phase spectrum from this.

I thought of using Euler's formula to convert the sine function, but then I'm a bit lost on how to use the exponential values to find the phase (if that's even correct?). So I got it to look like this: $$a = \frac{A(e^{jn*pi/2}-e^{-jn*pi/2})}{(2jn*pi/2)}$$

But then.. I'm not really sure? Because in the diagram the angle is pi, but I can't see how to get that.

This is a matter of convention - negative magnitude terms are 'absorbed' into the phase spectra so that the magnitude spectrum is positive. The pi phase terms in the phase spectra are points where the evaluation of the magnitude of the coefficient is equal to -1. (eg. sin(3pi/2) = -1)

Think about what happens when the magnitude is evaluated to -1, it can be thought of as A) a sine signal that has been inverted or B) a sine signal with magnitude +1 that is pi radians out of phase.

Hence instead of storing the information on the sine signal in the magnitude spectrum (by saying the magnitude is -1), we store the information in the phase spectrum by saying that the component actually has a magnitude of +1, and is pi radians out of phase.

Think about what phase really means in a signal that is only real valued - can phase be anything but 0 or pi/-pi here?

The phase of a complex number is the angle that the number makes with the positive real axis on a complex(Imaginary vs real) plot.

Since the coefficients are given by $$a=A \frac{\sin(n\pi/2)}{n\pi/2}$$ it can be seen that it is a real number for any value of n. So $$a$$ will have a phase of either 0 (for positive number) or $$\pi$$ (for negative number). Hence whenever the value of $$a$$ becomes negative the phase is $$\pi$$.

Since we are looking at double-sided spectra, I would expect that phase spectrum would be an odd function of $$f$$, since the signal in time is real. Thus, I would expect the phase would be $$\pi$$ for some of the positive frequencies and $$-\pi$$ for some of the negative ones - otherwise Euler's equations that convert complex exponentials into sinusoids do not hold.