Commit | Line | Data |
---|---|---|
1eeb62fb AIL |
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. | |
5fae0077 | 11 | rxfilter = comm.RaisedCosineReceiveFilter... |
1eeb62fb AIL |
12 | ('Shape', 'Square root', ... |
13 | 'RolloffFactor', rolloff, ... | |
14 | 'FilterSpanInSymbols', span, ... | |
15 | 'InputSamplesPerSymbol', sps, ... | |
5fae0077 AIL |
16 | 'DecimationFactor', 4, ... |
17 | 'DecimationOffset', mod(span+1, 4)); | |
1eeb62fb | 18 | |
5fae0077 AIL |
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); | |
1eeb62fb | 30 | end |