Using the following MatLab code, dress up your initials. Use different size symbols, different shapes and fills for 𝑍o.


% Transform Initials 
% What this MATLAB script does:
% 1) Plots my initials using scatter() in the complex plane.
% 2) Transforms initials using addition/multiplication of complex numbers
% 3) get creative?
%%                                                     initialize initials
clear all                                             % never not do this!
% -----------------------------------------
%              x= 012345678901234567890
%         y=6       ***    ***
%           5      *       *  *
%           4     *        *  *
%           3     *        ***               % 28 pts total (by counting!)
%           2     *        *  *
%           1      *       *  *
%           0       ***    ***
%              x= 012345678901234567890 
% ----------------------------------------- manually enter the coordinates
npts = 6;       
Zo = zeros(1,npts);                             % preallocate the Zo array
% -------------------------
Zo( 1) = 3  + 1i*0;
Zo( 2) = 4  + 1i*0;
Zo( 3) = 5  + 1i*0;
Zo( 4) = 11 + 1i*0;
Zo( 5) = 12 + 1i*0;
Zo( 6) = 13 + 1i*0;
% -------------------------
Zo( 7) = 2  + 1i*1;
Zo( 8) = 11  + 1i*1;
Zo( 9) = 14  + 1i*1;
% -------------------------
Zo(10) = 0  + 1i*2;
Zo(11) = 11  + 1i*2;
Zo(12) = 14 + 1i*2;
% -------------------------
Zo(13) = 0  + 1i*3;
Zo(14) = 11  + 1i*3;
Zo(15) = 12 + 1i*3;
Zo(16) = 13 + 1i*3;
% -------------------------
Zo(17) = 0  + 1i*4;
Zo(18) = 11  + 1i*4;
Zo(19) = 14 + 1i*4;
% -------------------------
Zo(20) = 1  + 1i*5;
Zo(21) = 11  + 1i*5;
Zo(22) = 14 + 1i*5;
% -------------------------
Zo(23) = 2  + 1i*6;
Zo(24) = 3  + 1i*6;
Zo(25) = 4  + 1i*6;
Zo(26) = 11  + 1i*6;
Zo(27) = 12  + 1i*6;
Zo(28) = 13  + 1i*6;
% ---------------------------------------------- check my inputed initials
figure(1);
clf;
scatter(real(Zo),imag(Zo),75,'blue','filled');
figure(1);
%error('stop here for now');
%%                         calculate center of mass and translate initials
% ---------------------------- method 1
%xCM = mean(real(Zo));
%yCM = mean(imag(Zo));
%Zo = Zo - (xCM + 1i*yCM);
% ---------------------------- method 2
zCM = mean(Zo);        % <= real & imaginary components act as a 2D vector
Zo = Zo - zCM;
% --------------------------------------------- check my centered initials
figure(1);
clf;
axis equal                                                      % optional
scatter(real(Zo),imag(Zo),75,'blue','filled');
figure(1);
% --------------------------------------------- setting limits is optional
%{
xMIN = min(real(Zo));
xMAX = max(real(Zo));
yMIN = min(imag(Zo));
yMAX = max(imag(Zo));
xMIN = xMIN - 0.5;
xMAX = xMAX + 0.5;
yMIN = yMIN - 0.5;
yMAX = yMAX + 0.5;
xlim( [xMIN,xMAX]);
ylim( [yMIN,yMAX]);
%}
%error('stop here for now');
%%                                                         do translations
%
  for i=1:5
  dZ = input('enter dZ for translation: ');
  Znew = Zo + dZ;
  figure(1);
  clf;
  scatter(real(Zo),imag(Zo),100,[0.85,0.85,0.85],'filled');
  hold on;
  scatter(real(Znew),imag(Znew),100,'blue','filled');
  figure(1);
  end
%}
%%                                                            do rotations
%{
  for i=1:5
  phi = input('enter phi for rotations (in degrees): ');
  phi = pi*phi/180;
  Zrot = exp(1i*phi);
  Znew = Zrot*Zo;
  figure(1);
  clf;
  scatter(real(Zo),imag(Zo),100,[0.85,0.85,0.85],'filled');
  hold on;
  scatter(real(Znew),imag(Znew),100,'blue','filled');
  figure(1);
  end
%}
%%                                             do general Z-multiplication
%{
  for i=1:5
  disp('Enter Z as R*exp(iphi)');
  R = input('enter R for magnitude of Z: ');
  phi = input('enter phi for rotations (in degrees): ');
  phi = pi*phi/180;
  Zmult = R*exp(1i*phi);
  Znew = Zmult*Zo;
  figure(1);
  clf;
  scatter(real(Zo),imag(Zo),100,[0.85,0.85,0.85],'filled');
  hold on;
  scatter(real(Znew),imag(Znew),100,'blue','filled');
  figure(1);
  end
%}