How is this frequency function calculated? I am trying to understand the solutions in my book and came across this:

What I dont understand is how they get the last result and where all the $\theta$s and $\pi$s come from.
 A: First, let's analyze how the argument of $H(i\omega)$ looks like. Note that $H(i\omega)$ is just a real number. Hence, the argument of a real number can only be either 0 or $\pi$ depending if the number is positive or negative
$$
\text{Arg} H(i\omega) = \left\{
\begin{array}{ll}
0 &\text{ if }H(i\omega)\geq 0 \Leftrightarrow |\omega|\leq |\omega_0|\\
\pi & \text{ if } H(i\omega)<0 \Leftrightarrow |\omega|>|\omega_0|
\end{array}\right.
$$
Thus, $\text{Arg} H(i\omega)$ as a function of $\omega$ looks like:

Now, this is there the "$\theta$" is important. I don't know if this is a standard notation (it may be in signal processing / control theory), but $\theta(\omega)$ usually denotes the Heaviside step function defined by:
$$
\theta(\omega) = \left\{
\begin{array}{ll}
1 &\text{ if } \theta\geq 0\\
0 & \text{ if } \theta<0
\end{array}\right.
$$
Note that the function $\text{Arg} H(i\omega)$ is made by two contributions:

*

*The contribution on the right of my drawing, is just a Heaviside step scaled by $\pi$ and shifted to (centered at) $\omega_0$. This is: $\pi\theta(\omega-\omega_0)$


*The contribution on the left is like the complement $1-\theta$ of the Heaviside step $\theta$, multiplied by $\pi$ and centered at $-\omega_0$. Thus is: $\pi( 1 - \theta(\omega+\omega_0))$.
Thus:
$$
\text{Arg} H(i\omega) = \pi( 1 - \theta(\omega+\omega_0)) + \pi\theta(\omega-\omega_0)
$$
You could leave the result as it is at this point. However, in the slide you are using, the author has a sign changed. This is equivalent and I'll explain why.
To arrive at such expression note that both step functions used in the drawing I made, don't overlap (they aren't non zero at the same place) and that an argument of $\pi$ is essentially the same as an argument of $-\pi$ (up to shifts of $2\pi$). Hence, we can interchange $\pi\to-\pi$ in one of the step functions with no effect. Thus, the argument is also equivalent to:
$$
\text{Arg} H(i\omega) = \pi( 1 - \theta(\omega+\omega_0)) - \pi\theta(\omega-\omega_0)
$$
where I changed the sign of the second step function. I don't see any reason for the author to take such decision, but the result is correct anyway.
