# Magnitude and phase graph of DTFT

I did a Discrete time Fourier transform of the following signal:

$$x[1]=4\quad x[-1]=-4$$

The result is $$4e^{j\omega}-4e^{-j\omega}$$

We were supposed to draw the magnitude and phase graph of this complex function.

Firstly, I turned it into complex sine using $$\sin(\alpha)=\frac{e^{j\alpha}-e^{-j\alpha}}{2j}$$:

$$4e^{j\omega}-4e^{-j\omega} = 8j\sin(\omega)$$

I then turned it into magnitude and phase parts:

$$8j\sin(\omega) = 8\sin(\omega)\cdot e^{j\frac{\pi}{2}}$$

From this, it is apparent (or it was apparent to me) that the magnitude graph is:

$$8\sin(\omega)$$ And the phase graph is: $$e^{j\frac{\pi}{2}} \implies\frac{\pi}{2}$$

I was able to draw the graphs of both of these but for some reason, both were incorrect. In the answer sheet, the magnitude was drawn in absolute value. And the phase was not on $$\frac{\pi}{2}$$ on the entire graph (as the function would suggest), but only on the positive part of the x axis. I don't know what I did wrong. The following image was in the answer sheet:

• What you did is very reasonable, but you got snagged in how you exactly define "magnitude". The standard definition requires the magnitude to be a positive number, but $\sin(\omega)$ will be negative, so the magnitude is actually $|\sin(\omega)|$. Wherever the sine wave goes negative you need to add (or subtract) $\pi$ to the phase. Feb 1, 2022 at 13:14
• @Hilmar Oh, that makes sense, it somehow eluded me that the magnitude needs to be positive (though it is obvious when I think about it). What I don't understand is: why do we need to substract pi on negative parts of the sine wave? I've been looking for an explanation that says explicitly why we do it but have been unable to find one so far. Feb 1, 2022 at 13:24

Your result for the DTFT is correct:

$$X(e^{j\omega})=8\sin(\omega)e^{j\pi/2}\tag{1}$$

However, Eq. $$(1)$$ does not explicitly show the magnitude and the phase. The magnitude should be non-negative, and $$\sin(\omega)$$ is obviously negative for $$-\pi<\omega<0$$.

The actual decomposition in magnitude and phase is

$$X(e^{j\omega})=\begin{cases}8|\sin(\omega)|e^{j\pi/2},&0<\omega<\pi\\8|\sin(\omega)|e^{-j\pi/2},&-\pi<\omega<0\end{cases}$$

where the sign change of $$\sin(\omega)$$ is reflected by the phase jump at $$\omega=0$$.

• Thank you so much for your answer! The magnitude now makes perfect sense to me, the phase part, however, I continue to miss. This is how I understand it now: After we make the spectral function absolute, it needs to be corrected on parts that are supposed to be negative by multiplying by $-1$ which is also $e^{\pi}$? Feb 1, 2022 at 13:28
• @ampersander: That's correct, except for $-1=e^{-j\pi}$, so you subtract $\pi$ from your original phase to compensate for the negative sign of $\sin(\omega)$ at negative frequencies. Feb 1, 2022 at 13:48
• The next question is: If $x[n]$ was the impulse response of a digital filter what would be its group delay versus frequency? Feb 1, 2022 at 15:16
• @RichardLyons: Question for whom? :) Feb 1, 2022 at 16:00
• @Matt L.: My poorly worded question was for the original poster. The question should have been: “Knowing that a filter’s group delay is the derivative of its phase with respect to frequency, if $x[n]$ was the three coefficients of a tapped-delay line digital filter what would be that filter’s group delay versus frequency? Feb 2, 2022 at 15:46

@ampersander: Your expression $$e^{j\frac{\pi}{2}}\implies\frac{\pi}{2}$$ is not correct. It should be $$e^{j\frac{\pi}{2}}=j$$. Thus Matt L.'s correct Eq (1) can be rewritten as $$X(e^{j\omega})=j8\sin(\omega)=0+j8\sin(\omega)$$ So the real part of $$X(e^{j\omega})$$ is zero and its imaginary part is a sine wave. On a complex plane $$X(e^{j\omega})$$ rides up and down always staying on the $$j$$ axis. And $$X(e^{j\omega})$$'s phase angle is always $$\pm\pi/2$$ radians.