sdr.fractional_delay_fir(length: int, delay: float) NDArray[float64]

Designs a fractional delay FIR filter impulse response \(h[n]\) using the Kaiser window method.

Parameters:
length: int

The filter length \(L\). Filters with even length have best performance. Filters with odd length are equivalent to an even-length filter with an appended zero.

delay: float

The fractional delay \(0 \le \Delta n \le 1\).

Returns:

The filter impulse response \(h[n]\) with length \(L\). The center of the passband has 0 dB gain.

Notes

The filter group delay is \(\tau = L_{even}/2 - 1 + \Delta n\) at DC.

References

Examples

Design a \(\Delta n = 0.25\) delay filter with length 8. Observe the width and flatness of the frequency response passband. Also observe the group delay of 3.25 at DC.

In [1]: h_8 = sdr.fractional_delay_fir(8, 0.25)

In [2]: plt.figure(); \
   ...: sdr.plot.impulse_response(h_8);
   ...: 

In [3]: plt.figure(); \
   ...: sdr.plot.magnitude_response(h_8); \
   ...: plt.ylim(-4, 1);
   ...: 

In [4]: plt.figure(); \
   ...: sdr.plot.group_delay(h_8);
   ...: 
../../_images/sdr_fractional_delay_fir_1.png ../../_images/sdr_fractional_delay_fir_2.png ../../_images/sdr_fractional_delay_fir_3.png

Compare the magnitude response and group delay of filters with different lengths.

In [5]: h_16 = sdr.fractional_delay_fir(16, 0.25); \
   ...: h_32 = sdr.fractional_delay_fir(32, 0.25); \
   ...: h_64 = sdr.fractional_delay_fir(64, 0.25)
   ...: 

In [6]: plt.figure(); \
   ...: sdr.plot.magnitude_response(h_8, label="Length 8"); \
   ...: sdr.plot.magnitude_response(h_16, label="Length 16"); \
   ...: sdr.plot.magnitude_response(h_32, label="Length 32"); \
   ...: sdr.plot.magnitude_response(h_64, label="Length 64"); \
   ...: plt.ylim(-4, 1);
   ...: 

In [7]: plt.figure(); \
   ...: sdr.plot.group_delay(h_8, label="Length 8"); \
   ...: sdr.plot.group_delay(h_16, label="Length 16"); \
   ...: sdr.plot.group_delay(h_32, label="Length 32"); \
   ...: sdr.plot.group_delay(h_64, label="Length 64");
   ...: 
../../_images/sdr_fractional_delay_fir_4.png ../../_images/sdr_fractional_delay_fir_5.png