function [xCD, kstart] = chromaticDispersion(x, D, lambda, z, Tsamp) %% Simulate chromatic dispersion. %% Params: %% - x: input waveform (pulse-shaped) %% - D: dispersion coefficient (ps / (nm km)) %% - lambda: wavelength (nm) %% - z: length of fibre (km) %% - Tsamp: sampling time (s) %% Output: %% - xCD: x after being dispersed. Energy of xCD is not normalized. %% - kstart: starting index of the discrete signal %% Convert everything to SI base units c = 299792458; % m/s D = D * 1e-6; % s/m^2 lambda = lambda * 1e-9; % m z = z * 1e3; % m %% kmax: maximum k at which to sample the inpulse response. %% See [1] Eq. (8), noting that the same omega (Eq. (7)) %% can be used for dispersion and dispersion compensation, %% as phi(t) is the same in both Eqs. (5) and (6). kmax = floor(abs(D) * lambda^2 * z / (2 * c * Tsamp^2)); k = -kmax : kmax; % index for discrete function t = k * Tsamp; % Impulse response g = exp(j * pi * c / (D * lambda^2 * z) * t .^ 2); lenx = length(x); leng = length(g); len_fft = max(lenx, leng); G = fft(g, len_fft); X = fft(x, len_fft); xCD = ifft(G.' .* X); l = (leng - 1) / 2; if l > 0 xCD = [xCD(l:end); xCD(1:l-1)]; end kstart = 1 - kmax; end %% References %% [1]: S.J. Savory, Digital filters for coherent optical receivers, 2008.