# Getting phase response from magnitude. How to develop and solve this Hilbert transform?

I'm trying to generate phase data from magnitude data in a frequency function, assuming the system is minimum phase. Using Hilbert Transform.

For instance, having this simple system:

$$G(s) = s$$

$$G(j\omega) = j\omega$$

Magnitude is: $$|G(j \omega)| = |j \omega| = \omega$$

And phase is: $$\arg[G(j\omega)] = \arg[j\omega] = \frac\pi2$$

In spite on knowing the system's phase response. I want to calculate the phase using Hilbert Transform.

In this wikipedia article, we find the magnitude and phase relationship of a minimum phase system, using Hilbert transform.

$$\arg \left[ G(j \omega) \right] = -\mathcal{H} \lbrace \ln \left( |G(j \omega)| \right) \rbrace$$

So for our example:

$$\arg \left[ G(j \omega) \right] = -\mathcal{H} \lbrace \ln (\omega) \rbrace = \frac\pi2$$

ln is base e logarithm.

Being the Hilbert Transform defined as:

$$\mathcal{H} \lbrace G(\omega) \rbrace \ \stackrel{\mathrm{def}}{=}\ \widehat{G}(\omega) = \frac{1}{\pi}\int_{-\infty}^{\infty}\frac{G(\tau)}{\omega-\tau}\, d\tau$$

So, for the system:

$$-\mathcal{H} \lbrace \ln (\omega) \rbrace = -\frac{1}{\pi}\int_{-\infty}^{\infty}\frac{\ln(\tau)}{\omega-\tau}\, d\tau = \frac{\pi}2$$

I need help for solve the improper integral. The anti-derivative of the expression inside the integral seems to be quite complicated. How do I use the Cauchy principal value?

How is the solution developed? How do I demostrate this equality? Thanks

The problem with your example is that there's a zero right on the imaginary axis, making the system not strictly minimum-phase, and inversion with a causal and stable filter is not possible. So let's slightly modify the frequency response by introducing a small constant $$\epsilon >0$$:

$$G(j\omega)=\epsilon+j\omega\tag{1}$$

This makes sure that the zero of $$G(s)$$ is strictly in the left half-plane, making the system strictly minimum-phase. Magnitude and phase are given by

$$\begin{eqnarray*} |G(j\omega)|&=&\sqrt{\epsilon^2+\omega^2}\\ \arg\{G(j\omega)\}&=&\arctan\left(\frac{\omega}{\epsilon}\right) \end{eqnarray*}$$

and we're trying to show that

$$\mathcal{H}\left\{-\ln\left(\sqrt{\epsilon^2+\omega^2}\right)\right\}=\arctan\left(\frac{\omega}{\epsilon}\right)\tag{2}$$

With

$$\begin{eqnarray*} \ln\left(\sqrt{\epsilon^2+\omega^2}\right)&=&\frac12\ln\left(\epsilon^2+\omega^2\right)\\ &=&\frac12\ln\left(\epsilon^2\right)+\frac12\ln\left(1+\left(\frac{\omega}{\epsilon}\right)^2\right) \end{eqnarray*}$$

we see that

$$\mathcal{H}\left\{-\ln(\sqrt{\epsilon^2+\omega^2})\right\}=\mathcal{H}\left\{-\frac12\ln\left(1+\left(\frac{\omega}{\epsilon}\right)^2\right)\right\}\tag{3}$$

because the Hilbert transform of a constant is zero.

In this answer I showed that

$$\mathcal{H}\left\{-\frac12\ln(1+\omega^2)\right\}=\arctan(\omega)\tag{4}$$

Using $$(3)$$, a simple substitution in $$(4)$$ shows that $$(2)$$ is indeed true.

Note that magnitude and phase of the originally proposed system - a differentiator - are given by

$$\begin{eqnarray*} |G(j\omega)|&=&|\omega|\\ \arg\{G(j\omega)\}&=&\frac{\pi}{2}\textrm{sign}(\omega) \end{eqnarray*}$$

From the correspondence $$(2)$$ we see that for $$\epsilon\to 0$$ the left-hand side becomes the Hilbert transform of $$-\ln(|\omega|)$$ and the right-hand side converges to $$\frac{\pi}{2}\textrm{sign}(\omega)$$.

It turns out that it can even be shown directly that $$-\ln|\omega|$$ and $$\frac{\pi}{2}\textrm{sign}(\omega)$$ are a Hilbert transform pair. First note that

$$\mathcal{H}\{-\ln|\omega|\}=\frac{\pi}{2}\textrm{sign}(\omega)\tag{5}$$

and

$$\mathcal{H}\left\{\frac{\pi}{2}\textrm{sign}(\omega)\right\}=\ln|\omega|\tag{6}$$

are equivalent statements because $$\mathcal{H}^{-1}\{\cdot\}=-\mathcal{H}\{\cdot\}$$.

In this answer I proved Eq. $$(6)$$. A short and simple version of the derivation is this:

$$\begin{eqnarray*} \mathcal{H}\left\{\frac{\pi}{2}\textrm{sign}(\omega)\right\}&=&\frac{\pi}{2}\frac{1}{\pi\omega}\star\textrm{sign}(\omega)\\&=&\frac12\left[\ln|\omega|\right]'\star\textrm{sign}(\omega)\\&=&\frac12\ln|\omega|\star\left[\textrm{sign}(\omega)\right]'\\&=&\frac12\ln|\omega|\star 2\delta(\omega)\\&=&\ln|\omega| \end{eqnarray*}$$

where $$\star$$ denotes convolution, and $$'$$ denotes the derivative.