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);
tstep = pi/20;
%t=0:tstep:tstep*40*2;
t=0:tstep:2*pi;
k=1;
d=0;
e3 = exp(k*t*j)*exp(j*d);
n = 40;
w1 = 1;
w2 = -1;
m1 = exp(-j*w1*n*2*pi/40);
m2 = exp(-j*w2*n*2*pi/40);
tc1 = m1 * [c1];
tc2 = m2 * [c1];
hFig = figure(1,'Position',[300 300 900 300]);
axisRange = [-3.1 3.1 -3.1 3.1];
subplot(2,5,1);
hold on;
plot(real(e3),imag(e3),'k-');
hold on;
plot(real(e3),imag(e3),'bo','MarkerFaceColor',[0 0 1]);
axis([-1.1 1.1 -1.1 1.1]);
xlabel('real : e^{j t}');
ylabel('imaginary : e^{j t}');
plot(real(m1),imag(m1),'ro',"markerfacecolor",[1 0 0],'MarkerSize',12);
daspect([1 1]);
quiver([0],[0],[real(m1)],[imag(m1)],"color","red","maxheadsize", 0.1);
line([-1.2 1.2],[0 0],'color','black');
line([0 0],[-1.2 1.2],'color','black');
hold off;
box off;
axis off;
daspect([1 1]);
subplot(2,5,2);
hold on;
plot(real(e3),imag(e3),'k-');
hold on;
plot(real(e3),imag(e3),'bo','MarkerFaceColor',[0 0 1]);
axis([-1.1 1.1 -1.1 1.1]);
xlabel('real : e^{j t}');
ylabel('imaginary : e^{j t}');
plot(real(m2),imag(m2),'ro',"markerfacecolor",[1 0 0],'MarkerSize',12);
daspect([1 1]);
quiver([0],[0],[real(m2)],[imag(m2)],"color","red","maxheadsize", 0.1);
line([-1.2 1.2],[0 0],'color','black');
line([0 0],[-1.2 1.2],'color','black');
hold off;
box off;
axis off;
daspect([1 1]);
subplot(2,5,3);
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(axisRange);
daspect([1 1]);
hold off;
grid on;
box on;
subplot(2,5,8);
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(axisRange);
daspect([1 1]);
hold off;
grid on;
box on;
subplot(2,5,4);
hold on;
tc = tc1(1,:);
plot(real(tc(1)),imag(tc(1)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
plot(real(tc(2)),imag(tc(2)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',8);
plot(real(tc(3)),imag(tc(3)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',8);
plot(real(tc(4)),imag(tc(4)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',8);
axis(axisRange);
daspect([1 1]);
hold off;
grid on;
box on;
subplot(2,5,9);
hold on;
tc = tc2(1,:);
plot(real(tc(1)),imag(tc(1)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
plot(real(tc(2)),imag(tc(2)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',8);
plot(real(tc(3)),imag(tc(3)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',8);
plot(real(tc(4)),imag(tc(4)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',8);
axis(axisRange);
daspect([1 1]);
hold off;
grid on;
box on;
subplot(2,5,5);
hold on;
tc = tc1(1,:)+tc2(1,:);
plot(real(tc(1)),imag(tc(1)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
plot(real(tc(2)),imag(tc(2)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',8);
plot(real(tc(3)),imag(tc(3)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',8);
plot(real(tc(4)),imag(tc(4)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',8);
axis(axisRange);
daspect([1 1]);
hold off;
grid on;
box on;
|