%
% circ2.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

a = [0 0; r/2 0; r/2-r/6 .1; r/2 0; r/2-r/6 -.1];
a = a';

plot(R(1,:),R(2,:),'k','linewidth',1.5)
hold on
plot(a(1,:)+r/4,a(2,:)-.5,'k','linewidth',1)
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.8,'y_1','fontsize',12)
text(r/2,0.7,'R_i','fontsize',12)
text(r-1.1,-r/2,'y_2','fontsize',12)
text(r+.4,-r/2,'R_m','fontsize',12)
text(r/2+r,-0.8,'y_3','fontsize',12)
text(r+r/2,0.7,'R_i','fontsize',12)
text(2*r-1.1,-r/2,'y_4','fontsize',12)
text(2*r+.4,-r/2,'R_m','fontsize',12)
text(r/2+2*r,-0.8,'y_5','fontsize',12)
text(2*r+r/2,0.7,'R_i','fontsize',12)
text(3*r-1.1,-r/2,'y_6','fontsize',12)
text(3*r+.4,-r/2,'R_m','fontsize',12)


rot = [0 1;-1 0];
V = rot*R;
d = rot*a;   % down arrow
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)
plot(d(1,:)+r-0.5,d(2,:)-r/4,'k','linewidth',1)
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(a(1,:)+r/4+r,a(2,:)-.5,'k','linewidth',1)
plot(R(1,:)+2*r,R(2,:),'k','linewidth',1.5)
plot(a(1,:)+r/4+2*r,a(2,:)-.5,'k','linewidth',1)
plot(V(1,:)+2*r,V(2,:),'k','linewidth',1.5)
plot(d(1,:)+2*r-0.5,d(2,:)-r/4,'k','linewidth',1)
plot(G(1,:)+2*r,G(2,:)-r,'k','linewidth',1.5)
plot(G(1,:)+3*r,G(2,:)-r,'k','linewidth',1.5)
plot(V(1,:)+3*r,V(2,:),'k','linewidth',1.5)
plot(d(1,:)+3*r-0.5,d(2,:)-r/4,'k','linewidth',1)

axis equal
%ylim([-4 1])
axis off




