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 >
x = [ ...
-1 1; ...
1 1; ...
1 -1; ...
-1 -1; ...
];
x = x';
c1 = x(1,:) + j*x(2,:);
c2 = circshift(c1,4);
n = 20;
%m = (1/2) .* [1 1; ...
% j exp(-j*n*2*pi/20)];
m = [1 0; ...
0 exp(-j*n*2*pi/20)];
tc = m * [c1; c2];
hFig = figure(1,'Position',[300 300 700 600]);
subplot(2,7,[1 3]);
hold on;
plot(real(c1(1)),imag(c1(1)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
plot(real(c1(2)),imag(c1(2)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',8);
plot(real(c1(3)),imag(c1(3)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',8);
plot(real(c1(4)),imag(c1(4)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',8);
axis([-2 2 -2 2]);
hold off;
grid on;
box on;
subplot(2,7,[8 10]);
hold on;
plot(real(c2(1)),imag(c2(1)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
plot(real(c2(2)),imag(c2(2)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',8);
plot(real(c2(3)),imag(c2(3)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',8);
plot(real(c2(4)),imag(c2(4)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',8);
axis([-2 2 -2 2]);
hold off;
grid on;
box on;
subplot(2,7,[5 7]);
hold on;
tc1 = tc(1,:);
plot(real(tc1(1)),imag(tc1(1)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
plot(real(tc1(2)),imag(tc1(2)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',8);
plot(real(tc1(3)),imag(tc1(3)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',8);
plot(real(tc1(4)),imag(tc1(4)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',8);
axis([-2 2 -2 2]);
hold off;
grid on;
box on;
subplot(2,7,[12 14]);
hold on;
tc2 = tc(2,:);
plot(real(tc2(1)),imag(tc2(1)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
plot(real(tc2(2)),imag(tc2(2)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',8);
plot(real(tc2(3)),imag(tc2(3)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',8);
plot(real(tc2(4)),imag(tc2(4)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',8);
axis([-2 2 -2 2]);
hold off;
grid on;
box on;
|