Working Kerr effect; PDM; speedups; removed unused files
[4yp.git] / txFilter.m
index 507ffe1..10c387d 100644 (file)
@@ -8,11 +8,17 @@ function x = txFilter(modData, rolloff, span, sps)
   %% Output:
   %%  - x: pulse-shaped waveform
 
-  filter = comm.RaisedCosineTransmitFilter...
+  txfilter = comm.RaisedCosineTransmitFilter...
                ('Shape', 'Square root', ...
                 'RolloffFactor', rolloff, ...
                 'FilterSpanInSymbols', span, ...
                 'OutputSamplesPerSymbol', sps, ...
                 'Gain', sqrt(sps)); % so that output has energy 1
-  x = filter([modData; zeros(span, 1)]);
+
+  coef = coeffs(txfilter);
+  filter_fft = fft(coef.Numerator, length(modData) * sps);
+  modData_fft = fft(upsample(modData, sps));
+  x = ifft(modData_fft .* filter_fft.');
+  l = (length(coef.Numerator) - 1) / 2;
+  x = [x(l:end); x(1:l-1)];
 end