%
% circdraw.m
%
close all
% root
R = [0 0; 1 0; 1.2 .25; 1.6 -.25; 2 .25; 2.4 -.25; 2.6 0; 3.6 0];
R = R';
r = max(R(1,:));     % length of a resistor

plot(R(1,:),R(2,:),'k','linewidth',1.5)
hold on
text(0,0.5,'x_1','fontsize',12)
text(r,0.5,'x_2','fontsize',12)
text(2*r,0.5,'x_3','fontsize',12)
text(3*r,0.5,'x_4','fontsize',12)
text(r/2,0.7,'y_1','fontsize',12)
text(r+.4,-r/2,'y_2','fontsize',12)
text(r/2+r,0.7,'y_3','fontsize',12)
text(2*r+.4,-r/2,'y_4','fontsize',12)
text(r/2+2*r,0.7,'y_5','fontsize',12)
text(r/2+3*r,0.7,'y_6','fontsize',12)


rot = [0 1;-1 0];
V = rot*R;
plot([0 0],[0 1/sqrt(2)-r/2],'k','linewidth',1.5)
plot([0 0],[-1/sqrt(2)-r/2 -r],'k','linewidth',1.5)
t = 0:.01:2*pi;
plot(cos(t)/sqrt(2),sin(t)/sqrt(2)-r/2,'k','linewidth',1.5)
text(-.2,-r/2-.1,'i_0','fontsize',12)
plot(r+V(1,:),V(2,:),'k','linewidth',1.5)
G = [-.2 0; .2 0; 0 -.2; -.2 0];
G = G';
plot(G(1,:),G(2,:)-r,'k','linewidth',1.5)
plot(G(1,:)+r,G(2,:)-r,'k','linewidth',1.5)
plot(R(1,:)+r,R(2,:),'k','linewidth',1.5)
plot(R(1,:)+2*r,R(2,:),'k','linewidth',1.5)
plot(V(1,:)+2*r,V(2,:),'k','linewidth',1.5)
plot(G(1,:)+2*r,G(2,:)-r,'k','linewidth',1.5)
H = -rot*G;
plot(H(1,:)+4*r,H(2,:),'k','linewidth',1.5)
plot(R(1,:)+3*r,R(2,:),'k','linewidth',1.5)

% deck
plot(3*r*[1 1],[-2 2],'k','linewidth',1.5)

% bottom tyne
plot(R(1,:)+3*r,R(2,:)-2,'k','linewidth',1.5)
plot(R(1,:)+4*r,R(2,:)-2,'k','linewidth',1.5)
plot(V(1,:)+4*r,V(2,:)-2,'k','linewidth',1.5)
plot(G(1,:)+4*r,G(2,:)-r-2,'k','linewidth',1.5)
plot(R(1,:)+5*r,R(2,:)-2,'k','linewidth',1.5)
plot(V(1,:)+5*r,V(2,:)-2,'k','linewidth',1.5)
plot(G(1,:)+5*r,G(2,:)-r-2,'k','linewidth',1.5)
plot(H(1,:)+6*r,H(2,:)-2,'k','linewidth',1.5)
text(4*r,-1.5,'x_7','fontsize',12)
text(5*r,-1.5,'x_8','fontsize',12)
text(r/2+3*r,-1.3,'y_{12}','fontsize',12)
text(4*r+.4,-2-r/2,'y_{13}','fontsize',12)
text(r/2+4*r,-1.3,'y_{14}','fontsize',12)
text(5*r+.4,-2-r/2,'y_{15}','fontsize',12)
text(r/2+5*r,-1.3,'y_{16}','fontsize',12)


% top tyne
plot(R(1,:)+3*r,R(2,:)+2,'k','linewidth',1.5)
plot(R(1,:)+4*r,R(2,:)+2,'k','linewidth',1.5)
plot(V(1,:)+4*r,V(2,:)+2+r,'k','linewidth',1.5)
plot(G(1,:)+4*r,-G(2,:)+r+2,'k','linewidth',1.5)
plot(R(1,:)+5*r,R(2,:)+2,'k','linewidth',1.5)
plot(V(1,:)+5*r,V(2,:)+2+r,'k','linewidth',1.5)
plot(G(1,:)+5*r,-G(2,:)+r+2,'k','linewidth',1.5)
plot(H(1,:)+6*r,H(2,:)+2,'k','linewidth',1.5)
text(4*r,1.5,'x_5','fontsize',12)
text(5*r,1.5,'x_6','fontsize',12)
text(r/2+3*r,2.7,'y_7','fontsize',12)
text(4*r+.4,2+r/2,'y_8','fontsize',12)
text(r/2+4*r,2.7,'y_9','fontsize',12)
text(5*r+.4,2+r/2,'y_{10}','fontsize',12)
text(r/2+5*r,2.7,'y_{11}','fontsize',12)

axis equal
axis off



