Followings are the code that I wrote in Octave to creates all the plots shown in this page. You may copy these code and play with these codes. Change variables and try yourself until you get your own intuitive understanding.
< Code 1 >
N = 500;
rand ("seed", 100);
n1 = 0.05*(randn(1,N) + j*randn(1,N));
n2 = 0.05*(randn(1,N) + j*randn(1,N));
c1 = (2*randi([0 1],1,N)-1) + j*(2*randi([0 1],1,N)-1);
c2 = (2*randi([0 1],1,N)-1) + j*(2*randi([0 1],1,N)-1);
c1 = c1 + n1;
c2 = c2 + n2;
n = 1;
%H = (1/2) .* [1 1; ...
% j exp(-j*n*2*pi/20)];
H = (1/2) .* [1 1; ...
j -j];
%H = [0.9+j*0.1 0.2-j*0.3; ...
% -0.3+j*0.5 -0.7-j*0.1];
[u s v] = svd(H);
Tx = [c1; c2];
PrecodedTx = v * Tx;
Rx = H * PrecodedTx;
EqRx = inv(s) * u' * Rx;
hFig = figure(1,'Position',[300 300 700 350]);
subplot(2,11,[1 3]);
plot(real(Tx(1,:)),imag(Tx(1,:)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',4);
axis([-2 2 -2 2]);
title('Tx(1)');
grid on;
box on;
subplot(2,11,[12 14]);
plot(real(Tx(2,:)),imag(Tx(2,:)),'mo','MarkerFaceColor',[1 0 1],'MarkerSize',4);
axis([-2 2 -2 2]);
title('Tx(2)');
grid on;
box on;
subplot(2,11,[5 7]);
hold on;
plot(real(Rx(1,:)),imag(Rx(1,:)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',4);
axis([-2 2 -2 2]);
title('Rx(1)');
hold off;
grid on;
box on;
subplot(2,11,[16 18]);
hold on;
plot(real(Rx(2,:)),imag(Rx(2,:)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',4);
axis([-2 2 -2 2]);
title('Rx(2)');
hold off;
grid on;
box on;
subplot(2,11,[9 11]);
hold on;
plot(real(EqRx(1,:)),imag(EqRx(1,:)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',4);
axis([-2 2 -2 2]);
title('Equalized Rx(1)');
hold off;
grid on;
box on;
subplot(2,11,[20 22]);
hold on;
plot(real(EqRx(2,:)),imag(EqRx(2,:)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',4);
axis([-2 2 -2 2]);
title('Equalized Rx(2)');
hold off;
grid on;
box on;
|