0
$\begingroup$

The graph below shows a linear phase response of FIR Hilbert transformer with a constant diff of -0.06135923. I am not sure if I understand the concept of the phase response correctly, but as the quadrature is the input signal shifted by PI/2, why is the phase response not a straight horizontal line at PI/2? enter image description here

The code to generate the figure was copied directly from Scipy's documentation (the example at the bottom of the page) except that I did not unwrap the phase angle and I used the following filter coefficients:

N = 10
b = [2*np.sin(np.pi*n/2)**2/(np.pi*n) for n in range(1, N+1)]
b = np.append(-1*np.flip(b, 0), np.append([0], b))*np.hamming(2*N+1)

I tried the same with different values of N and each time the behavior of the phase response line was the same, just the steepness was varying.

$\endgroup$
1
$\begingroup$

The slope represents a delay of $N$ samples. You can center the impulse response to time zero by multiplying the transfer function by $e^{i\omega N}$ (transfer function of a negative delay of $N$ samples) or np.exp(1j*w*N) in Python:

from scipy import signal
import numpy as np
N = 10
b = [2*np.sin(np.pi*n/2)**2/(np.pi*n) for n in range(1, N+1)]
b = np.append(-1*np.flip(b, 0), np.append([0], b))*np.hamming(2*N+1)
w, h = signal.freqz(b)
h = h*np.exp(1j*w*N)
import matplotlib.pyplot as plt
fig = plt.figure()
plt.title('Digital filter frequency response')
ax1 = fig.add_subplot(111)
plt.plot(w, 20 * np.log10(abs(h)), 'b')
plt.ylabel('Amplitude [dB]', color='b')
plt.xlabel('Frequency [rad/sample]')
ax2 = ax1.twinx()
angles = np.angle(h)
plt.plot(w, angles, 'g')
plt.ylabel('Angle (radians)', color='g')
plt.grid()
plt.axis('tight')
plt.show()

Most of the above is from Scipy documentation which you link to. This gets plotted:


Figure 1. Frequency response of the Hilbert transformer centered at time zero.

The phase goes to zero at frequency zero, because the phase frequency response transitions from $-\pi/2$ for positive frequencies to $\pi/2$ for negative frequencies.

$\endgroup$
1
$\begingroup$

You have a linear phase, which is expected for a causal filter: the filter is delayed in the time domain, not centered about $t=0$.

Recall the shift theorem of the Fourier Transform. A shift in the time domain corresponds to modulation by a complex exponential in the frequency domain.

$\endgroup$
0
$\begingroup$

why is the phase response not a straight horizontal line at PI/2?

It can't be! Because group delay is the derivative of phase over frequency, that'd mean that you get zero group delay (because a constant $\frac\pi2$ doesn't depend on $f$).

Since this is a causal filter, you can't have zero delay. That'd be awesome, but impossible for causal systems.

So, think of this as your constant-phase thing, just shifted in time by half the filter length to become causal. In frequency domain, a time shift becomes a multiplication with a complex oscillation, and that has linear phase!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.