| 1 | function [xCD, kstart] = chromaticDispersion(x, D, lambda, z, Tsamp) |
| 2 | %% Simulate chromatic dispersion. |
| 3 | %% Params: |
| 4 | %% - x: input waveform (pulse-shaped) |
| 5 | %% - D: dispersion coefficient (ps / (nm km)) |
| 6 | %% - lambda: wavelength (nm) |
| 7 | %% - z: length of fibre (km) |
| 8 | %% - Tsamp: sampling time (s) |
| 9 | %% Output: |
| 10 | %% - xCD: x after being dispersed. Energy of xCD is not normalized. |
| 11 | %% - kstart: starting index of the discrete signal |
| 12 | |
| 13 | %% Convert everything to SI base units |
| 14 | c = 299792458; % m/s |
| 15 | D = D * 1e-6; % s/m^2 |
| 16 | lambda = lambda * 1e-9; % m |
| 17 | z = z * 1e3; % m |
| 18 | |
| 19 | %% kmax: maximum k at which to sample the inpulse response. |
| 20 | %% See [1] Eq. (8), noting that the same omega (Eq. (7)) |
| 21 | %% can be used for dispersion and dispersion compensation, |
| 22 | %% as phi(t) is the same in both Eqs. (5) and (6). |
| 23 | kmax = floor(abs(D) * lambda^2 * z / (2 * c * Tsamp^2)); |
| 24 | k = -kmax : kmax; % index for discrete function |
| 25 | |
| 26 | t = k * Tsamp; |
| 27 | |
| 28 | % Impulse response |
| 29 | g = sqrt(c / (j * D * lambda^2 * z)) * ... |
| 30 | exp(j * pi * c / (D * lambda^2 * z) * t .^ 2); |
| 31 | |
| 32 | xCD = conv(x, g); |
| 33 | |
| 34 | kstart = 1 - kmax; |
| 35 | end |
| 36 | %% References |
| 37 | %% [1]: S.J. Savory, Digital filters for coherent optical receivers, 2008. |