# Deducing phase from frequency response $1-z^{-1}$

In Boaz Porat's book about signal proccessing, at part 8 he mentions the example: $$H\left(z\right)=1-z^{-1}\Rightarrow H^{f}\left(\theta\right)=1-e^{-j\theta}=\left(e^{\frac{j\theta}{2}}-e^{-\frac{j\theta}{2}}\right)e^{-\frac{j\theta}{2}}= \\ 2j\sin\left(\frac{\theta}{2}\right)e^{-\frac{j\theta}{2}}=2\sin\left(\frac{\theta}{2}\right)e^{j\left(\frac{\pi}{2}-\frac{\theta}{2}\right)}$$ Therefore the amplitude and phase are given by: $$\left|H^{f}\left(\theta\right)\right|=\left|2\sin\left(\frac{\theta}{2}\right)\right|$$ $$\psi\left(\theta\right)=\begin{cases} \frac{\pi}{2}-\frac{\theta}{2} & 0<\theta<\pi\\ -\frac{\pi}{2}-\frac{\theta}{2} & -\pi<\theta<0 \end{cases}$$ How did he find the phase and why would it not be the same for all $$-\pi <\theta <\pi$$?

Also, how would the phase look if instead of $$\sin$$ he would represent it with a $$\cos$$? would the regions be $$\begin{cases} -\frac{\pi}{2}-\frac{\theta}{2} & \frac{\pi}{2}<\theta<\pi\\ \frac{\pi}{2}-\frac{\theta}{2} & -\frac{\pi}{2}<\theta<\frac{\pi}{2}\\ -\frac{\pi}{2}-\frac{\theta}{2} & -\pi<\theta<-\frac{\pi}{2} \end{cases}$$

In general, how do I find the frequency response given a transfer function?

Say you want to express $$x$$ as modulus and phase. This is: $$x = |x|$$ if $$x \ge 0$$, and $$x = -|x|$$ when $$x < 0$$. That minus sign is equivalent to a phase of $$\pi$$; remember that $$-1 = e^{j\pi}$$.
For your example above, when $$\sin(\cdots)$$ is negative, then you have to add (or subtract) a phase of $$\pi$$, which is why you have 2 expressions for the phase depending on the frequency $$\theta$$. And there is an extra $$\pi/2$$ phase that comes from the $$j$$ multiplying the sine.
• For your last comment, couldn't we use $sin(\theta) = \cos(\theta - \pi/2)$ ? Commented Jan 25, 2023 at 3:11