Chromatic dispersion and line width phase noise
[4yp.git] / txFilter.m
diff --git a/txFilter.m b/txFilter.m
new file mode 100644 (file)
index 0000000..49164d3
--- /dev/null
@@ -0,0 +1,17 @@
+function x = txFilter(modData, rolloff, span, sps)
+  %% Transmitter pulse-shaping (root raised cosine) filter.
+  %% Inputs:
+  %%  - modData: modulated data
+  %%  - rolloff: rolloff factor in root raised cosine filter.
+  %%  - span: filter span (number of symbols)
+  %%  - sps: samples per symbol
+  %% Output:
+  %%  - x: pulse-shaped waveform
+
+  filter = comm.RaisedCosineTransmitFilter...
+               ('Shape', 'Square root', ...
+                'RolloffFactor', rolloff, ...
+                'FilterSpanInSymbols', span, ...
+                'OutputSamplesPerSymbol', sps);
+  x = filter([modData; zeros(span, 1)]);
+end