CommPy
CommPy copied to clipboard
RootRaisedCosine impulse response seem incorrect
When comparing a RRC impulse response generated by CommPy to those of other reference implementations, the results seem incorrect -- e.g., not even symmetric. I don't have screenshots at the moment, since I changed implementations, but may try to show evidence here.
Just a warning to those using it for pulse shaping.. it's not perfect.
Indeed, all the filters functions return non-symmetric filters.
The time indexes are defined as:
T_delta = 1/float(Fs)
time_idx = ((np.arange(N)-N/2))*T_delta
As an example we have:
- for N = 5, T=_delta = 1, time_idx = [-2.5, -1.5, -0.5, 0.5, 1.5]
- for N = 6, T=_delta = 1, time_idx = [-3., -2., -1., 0., 1., 2.]
Shouldn't the time indexes be symmetric like the following ?:
- for N=5, time_idx = [-2., -1, 0. 1., 2.]
- for N=6, time_idx = [-2.5, -1.5, -0.5, 0.5, 1.5 , 2.5]
which correspond to:
time_idx = (np.arange(N)-(N-1)/2) * T_delta
Hi @thomasfillon,
This could make sense. As I do not know enough about the module to provide a conclusive opinion, could you make the change and compare the result with a reference? That way, we would be assured that the issue is properly resolved.
Hi @BastienTr ,
OK, I will send a pull request with the proposed code modification and some tests. @dan-1d What reference implementations were you comparing with ?
@thomasfillon Good question! I think it was a MATLAB implementation in the "comm" toolbox, but it could have been in-house code. We ended up writing our own in Python, and I haven't gotten back to this since... I can perhaps compare the fix at some point.
If you happen to choose a an even number of taps (80 in this case), no error is reported, but this is what you get:
pos, taps = rrcosfilter(int(samples_per_symbol * 8), 0.5, 1.0/symbol_rate, sample_rate)