Matrix Complex - Vector

 

This tutorial shows an example of a complex number with a 2x1 vector that is made up of complex number elements. It performs this operation for every points of 500 complex numbers  on the left side and displays the result on the right side as shown below.  

 

I used a vector with a very special complex number which is very widely used in engineering. It is the complex number expressed in Euler form.

If you are not familiar with Complex Number, see my note on Complex number. If you don't know how to do complex number multiplication, see this note.

 

 

 

 

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;

 

n1 = 8;

n2 = 4;

m = [1; ...

     exp(j*n1*pi/8); ...

     exp(j*n2*pi/4) * 1; ...

     exp(j*n2*pi/4) * exp(j*n1*pi/8)];

 

tc = m * c1;

     

hFig = figure(1,'Position',[300 300 350 600]);    

 

subplot(4,7,[1 3]);

plot(real(c1),imag(c1),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',4);

axis([-2 2 -2 2]);

grid on;

box on;

pbaspect([1 1 1]);

tStr = sprintf("[n1,n2]=[%d,%d] \n x",n1,n2);

title(tStr);

 

%subplot(2,7,[8 10]);

%plot(real(c2),imag(c2),'mo','MarkerFaceColor',[1 0 1],'MarkerSize',4);

%axis([-2 2 -2 2]);

%grid on;

%box on;

%pbaspect([1 1 1]);

 

subplot(4,7,[5 7]);     

hold on;

plot(real(tc(1,:)),imag(tc(1,:)),'ro','MarkerFaceColor',[1 0 0],'MarkerSize',4);

axis([-2 2 -2 2]);

hold off;

grid on;

box on;

pbaspect([1 1 1]);

title('y1');

 

subplot(4,7,7+[5 7]);     

hold on;

plot(real(tc(2,:)),imag(tc(2,:)),'go','MarkerFaceColor',[0 1 0],'MarkerSize',4);

axis([-2 2 -2 2]);

hold off;

grid on;

box on;

pbaspect([1 1 1]);

title('y2');

 

subplot(4,7,14+[5 7]);     

hold on;

plot(real(tc(3,:)),imag(tc(3,:)),'bo','MarkerFaceColor',[0 0 1],'MarkerSize',4);

axis([-2 2 -2 2]);

hold off;

grid on;

box on;

pbaspect([1 1 1]);

title('y3');

 

subplot(4,7,21+[5 7]);     

hold on;

plot(real(tc(4,:)),imag(tc(4,:)),'ko','MarkerFaceColor',[0 0 0],'MarkerSize',4);

axis([-2 2 -2 2]);

hold off;

grid on;

box on;

pbaspect([1 1 1]);

title('y4');