Commit | Line | Data |
---|---|---|
1eeb62fb AIL |
1 | function x = txFilter(modData, rolloff, span, sps) |
2 | %% Transmitter pulse-shaping (root raised cosine) filter. | |
3 | %% Inputs: | |
4 | %% - modData: modulated data | |
5 | %% - rolloff: rolloff factor in root raised cosine filter. | |
6 | %% - span: filter span (number of symbols) | |
7 | %% - sps: samples per symbol | |
8 | %% Output: | |
9 | %% - x: pulse-shaped waveform | |
10 | ||
5fae0077 | 11 | txfilter = comm.RaisedCosineTransmitFilter... |
1eeb62fb AIL |
12 | ('Shape', 'Square root', ... |
13 | 'RolloffFactor', rolloff, ... | |
14 | 'FilterSpanInSymbols', span, ... | |
f9a73e9e AIL |
15 | 'OutputSamplesPerSymbol', sps, ... |
16 | 'Gain', sqrt(sps)); % so that output has energy 1 | |
5fae0077 AIL |
17 | |
18 | coef = coeffs(txfilter); | |
19 | filter_fft = fft(coef.Numerator, length(modData) * sps); | |
20 | modData_fft = fft(upsample(modData, sps)); | |
21 | x = ifft(modData_fft .* filter_fft.'); | |
22 | l = (length(coef.Numerator) - 1) / 2; | |
23 | x = [x(l:end); x(1:l-1)]; | |
1eeb62fb | 24 | end |