| 1 | function r = rxFilter(y, rolloff, span, sps) |
| 2 | %% Receiver matched (root raised cosine) filter. |
| 3 | %% Inputs: |
| 4 | %% - y: received waveform |
| 5 | %% - rolloff: rolloff factor in root raised cosine filter. |
| 6 | %% - span: filter span (number of symbols) |
| 7 | %% - sps: samples per symbol |
| 8 | %% Output: |
| 9 | %% - r: filtered signal (energy not normalized), |
| 10 | %% normalize and then sample. |
| 11 | rxfilter = comm.RaisedCosineReceiveFilter... |
| 12 | ('Shape', 'Square root', ... |
| 13 | 'RolloffFactor', rolloff, ... |
| 14 | 'FilterSpanInSymbols', span, ... |
| 15 | 'InputSamplesPerSymbol', sps, ... |
| 16 | 'DecimationFactor', 4, ... |
| 17 | 'DecimationOffset', mod(span+1, 4)); |
| 18 | |
| 19 | coef = coeffs(rxfilter); |
| 20 | filter_fft = fft(coef.Numerator, length(y)); |
| 21 | y_fft = fft(y); |
| 22 | |
| 23 | rs = ifft(y_fft .* filter_fft.'); |
| 24 | |
| 25 | %% re-order signal due to circular conv |
| 26 | l = (length(coef.Numerator) - 1) / 2; |
| 27 | rr = [rs(l:end); rs(1:l-1)]; |
| 28 | |
| 29 | r = downsample(rr, 4, 3); |
| 30 | end |