CommPy icon indicating copy to clipboard operation
CommPy copied to clipboard

RootRaisedCosine impulse response seem incorrect

Open dan-1d opened this issue 4 years ago • 5 comments

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.

dan-1d avatar Apr 15 '20 23:04 dan-1d

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

thomasfillon avatar Sep 30 '20 12:09 thomasfillon

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.

BastienTr avatar Sep 30 '20 13:09 BastienTr

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 avatar Sep 30 '20 15:09 thomasfillon

@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.

dan-1d avatar Sep 30 '20 15:09 dan-1d

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)

bad_rrc

mobilinkd avatar Nov 04 '20 20:11 mobilinkd