eb25a32d2ca52449e03f19e43ae864cde0de8454
[4yp.git] / rxFilter.m
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   filter = comm.RaisedCosineReceiveFilter...
12                  ('Shape', 'Square root', ...
13                   'RolloffFactor', rolloff, ...
14                   'FilterSpanInSymbols', span, ...
15                   'InputSamplesPerSymbol', sps, ...
16                   'DecimationFactor', 1);
17
18   r = filter([y; zeros(span * sps, 1)]);
19   r = r(span * sps / 2 + 1 : end); % truncate filter transients
20 end