zs = 42;
plotlen = length(zs);
-
%% Tx RRC filter properties
rolloff = 0.25;
span = 6; % filter span
%% Stores result to be plotted
ber = zeros(plotlen, 1);
if plotlen > 1
- fig = figure; hold on;
+ fig = figure;
end
%% sps and Tsamp change at Tx/Rx, save these for later.
Tsamp = TsampOrig;
%% Split-step Fourier
- [A_x, A_y] = ssfs(A_x, A_y, D, lambda, z, dz, Tsamp, gamma, alpha);
+ [Al_x, Al_y] = ssfs(A_x, A_y, D, lambda, z, dz, Tsamp, gamma, alpha);
%% Phase noise
- A_x = phaseNoise(A_x, linewidthTx, linewidthLO, Tsamp);
- A_y = phaseNoise(A_y, linewidthTx, linewidthLO, Tsamp);
+ Al_x = phaseNoise(Al_x, linewidthTx, linewidthLO, Tsamp);
+ Al_y = phaseNoise(Al_y, linewidthTx, linewidthLO, Tsamp);
%% Here, only receive the central channel 1.
- % For channel n: A_x .* conj(carriers(:, n)); etc.
- r_x = rxFilter(A_x, rolloff, span, sps);
- r_y = rxFilter(A_y, rolloff, span, sps);
+ % For channel n: Al_x .* conj(carriers(:, n)); etc.
+ r_x = rxFilter(Al_x, rolloff, span, sps);
+ r_y = rxFilter(Al_y, rolloff, span, sps);
% Rx filter performs downsampling as well, keep track of this
sps = 2;
Tsamp = Tsamp * spsOrig / sps;
[~, ber(i)] = biterr([data_x(:, 1); data_y(:, 1)], [demod_x; demod_y]);
q = 20 * log10(erfcinv(2*ber)*sqrt(2));
- if plotlen > 1
+ if i > 1
figure(fig);
plot(zs, q);
end
%% Input: rx, ry: Both polarizations of received signal
%% Output: x, y: Equalizaed signal
- taps = 19; % Number of taps. Should be odd.
+ taps = 15; % Number of taps. Should be odd.
mu = 1e-3; % Convergence parameter for gradient descent.
hxx = zeros(taps, 1);
yp = [zeros((taps - 1) / 2 - it + 1, 1); ry(1:it + (taps - 1) / 2)];
elseif it + (taps - 1) / 2 > numSymbs
%% If near the end, append zeros
- xp = [rx(it - (taps - 1) / 2 : end); zeros(it + (taps - 1) / 2 - numSymbs, 1)];
- yp = [ry(it - (taps - 1) / 2 : end); zeros(it + (taps - 1) / 2 - numSymbs, 1)];
+ xp = [rx(it - (taps - 1) / 2 : end); ...
+ zeros(it + (taps - 1) / 2 - numSymbs, 1)];
+ yp = [ry(it - (taps - 1) / 2 : end); ...
+ zeros(it + (taps - 1) / 2 - numSymbs, 1)];
else
%% Just slice the signal
xp = rx(it - (taps - 1) / 2 : it + (taps - 1) / 2);