sdr.polyphase_matrix(up: int, down: int, taps: ArrayLike) NDArray

Converts the multirate FIR filter taps \(h_i\) into the polyphase matrix \(H_{i, j}\) that achieves rational resampling by \(P/Q\).

Parameters:
up: int

The interpolation rate \(P\).

down: int

The decimation rate \(Q\).

taps: ArrayLike

The multirate FIR filter taps \(h_i\).

Returns:

The polyphase matrix \(H_{i, j}\).

Notes

The multirate FIR filter taps \(h_i\) are arranged down the columns of the polyphase matrix \(H_{i, j}\) as follows:

Polyphase Matrix
+------+------+------+------+
| h[0] | h[3] | h[6] | h[9] |
+------+------+------+------+
| h[1] | h[4] | h[7] | 0    |
+------+------+------+------+
| h[2] | h[5] | h[8] | 0    |
+------+------+------+------+

References

  • fred harris, Multirate Signal Processing for Communication Systems, Chapter 7: Resampling Filters

Examples

Convert the multirate FIR filter (notional taps for demonstration) into a polyphase matrix for rational resampling by 3/4 and 1/6.

In [1]: h = np.arange(0, 20)

In [2]: sdr.polyphase_matrix(3, 4, h)
Out[2]: 
array([[ 0,  3,  6,  9, 12, 15, 18],
       [ 1,  4,  7, 10, 13, 16, 19],
       [ 2,  5,  8, 11, 14, 17,  0]])

In [3]: sdr.polyphase_matrix(1, 6, h)
Out[3]: 
array([[ 0,  6, 12, 18],
       [ 1,  7, 13, 19],
       [ 2,  8, 14,  0],
       [ 3,  9, 15,  0],
       [ 4, 10, 16,  0],
       [ 5, 11, 17,  0]])