Chromatic dispersion and line width phase noise
[4yp.git] / chromaticDispersion1Signal.m
CommitLineData
1eeb62fb
AIL
1M = 4;
2numSymbs = 1000;
3
4%% https://www.mathworks.com/help/comm/examples/passband-modulation-with-adjacent-channel-interference.html
5Rsym = 2.5e10; % symbol rate (sym/sec)
6
7span = 6; % Tx/Rx filter span
8rolloff = 0.25; % Tx/Rx RRC rolloff
9sps = 4; % samples per symbol
10
11
12fs = Rsym * sps; % sampling freq (Hz)
13Tsamp = 1 / fs;
14
15t = (0 : 1 / fs : numSymbs / Rsym + (1.5 * span * sps - 1) / fs)';
16
17
18data = randi([0 M - 1], numSymbs, 1);
19modData = pskmod(data, M, 0, 'gray');
20x = txFilter(modData, rolloff, span, sps);
21
22%% Simulate chromatic dispersion
23D = 20; % ps / (nm km)
24lambda = 1550; % nm
25z = 1000; % km
26
27[xCD, xCDkstart] = chromaticDispersion(x, D, lambda, z, Tsamp);
28xCD = normalizeEnergy(xCD, numSymbs, 1);
29
30
31y = xCD;
32
33
34yCDComp = CDCompensation(y, D, lambda, z, Tsamp);
35
36%% Compare original signal and compensated signal
37figure(1);
38subplot(211);
39plot(real(x(1:300)));
40hold on
41plot(real(yCDComp(1:300)));
42hold off
43title('Real part');
44legend('original', 'dispersion compensated');
45subplot(212);
46plot(imag(x(1:300)));
47hold on
48plot(imag(yCDComp(1:300)));
49hold off
50title('Imag part');
51
52
53r = rxFilter(yCDComp, rolloff, span, sps);
54r = normalizeEnergy(r, numSymbs, 1); % Add noise energy if needed
55
56rSampled = r(sps*span/2+1:sps:(numSymbs + span/2) * sps);
57
58scatterplot(modData);
59title('Constellation of original modulation');
60scatterplot(rSampled);
61title('Constellation of sampled received waveform');
62
63demodData = pskdemod(rSampled, M, 0, 'gray');