# Hilbert Transform, filters - two different phase graphs

Relationship between magnitude response and phase response for minimum phase is:

Phase plots are obtained from Hilbert transform of real magnitude values. Input to Hilbert transform was a vector (array) of real magnitude values in dB. Magnitude vs. frequency (Fig. 1.) is a raised-cosine function defining a Mesa filter with plateau.

I obtained phase values in two ways. In Fig. 2. the resulting phase plot (phase from the previous formula, not the phase from analytic signal) is obtained from SciLab using command x = -hilbert(xr), printing imag(x). Variable xr is vector holding magnitude values. In Fig. 3. the phase plot (phase from the previous formula, not the phase from analytic signal) is obtained from C implementation of Hilbert transform taken from ht.c file on the web. Hilbert transform here is implemented as convolution and the values are in xh[i].

Although similar, the phase plots on Fig. 2. and Fig. 3. are quite different. Any insights why I am getting two different graphs of phase?

• The hilbert command in Scilab returns the analytic signal associated with xr, not its Hilbert transform. Taking imag(x) should produce the Hilbert transform, but that's not the phase you're plotting. Can you be more explicit about how you're generating the second plot? i.e. what Scilab commands did you use? I suspect the different you're seeing is because of different implementations of the Hilbert transform. ht.c uses an FIR filter. Perhaps Scilab uses an FFT-based approach (that's what the sole reference above says)? – Peter K. Jul 3 '15 at 15:36
• @PeterK. I am aware that SciLab's hilbert command produces analytic signal. Hence, imag(x) is my Hilbert transform, as I mentioned in my question, and I plot that. As I wrote, I use x=-hilbert(xr) in SciLab. I am suspecting that SciLab uses "FFT->phase shift->IFFT method for Hilbert transform, but not sure. – Nebojsa Jul 3 '15 at 16:11
• Umm. Plotting the imaginary part isn't the same as plotting the phase. You would have to use use phasemag (help.scilab.org/doc/5.3.3/en_US/phasemag.html) to get the magnitude and phase from your complex number. – JRE Jul 3 '15 at 16:29
• @JRE Imaginary part of x is exactly Hilbert transform. Real part is equal to the input real sequence. I am not talking here about the phase of the analytic complex signal, but rather about the phase obtained from my first equation in the question. – Nebojsa Jul 3 '15 at 17:24
• ht.c returns magnitude and phase. SciLab Hilbert returns real and imaginary. You have to convert from complex to polar and take the angle to get phase. That is what SciLab phasemag does. – JRE Jul 3 '15 at 19:38