%
% ex1p1.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';

rot = [0 1;-1 0];
V = rot*R;
d = rot*a;   % down arrow

plot(R(1,:),r+R(2,:),'k','linewidth',1.5)
hold on
plot(r+R(1,:),r+R(2,:),'k','linewidth',1.5)
plot(R(1,:),R(2,:)-r,'k','linewidth',1.5)
plot(r+R(1,:),R(2,:)-r,'k','linewidth',1.5)
t = 0:.01:2*pi;
plot(r+cos(t)/1.6,sin(t)/1.6-r/2,'k','linewidth',1.5)
plot([r r],[0 -r/2+1/1.6],'k','linewidth',1.5)
plot([r r],[-r -r/2-1/1.6],'k','linewidth',1.5)

plot(a(1,:)+r/4,a(2,:)+r-.5,'k','linewidth',1)
plot(0,r,'ko')
plot(r,r,'ko')
plot(2*r,r,'ko')
text(0,r+.4,'1','fontsize',12)
text(r,r+.4,'2','fontsize',12)
text(2*r,r+.4,'3','fontsize',12)
text(r/2,r-1,'1','fontsize',12)
plot(a(1,:)+5*r/4,a(2,:)+r-.5,'k','linewidth',1)
text(3*r/2,r-1,'2','fontsize',12)
plot(0,-r,'ko')
plot(r,-r,'ko')
plot(2*r,-r,'ko')
text(0,-r-.4,'5','fontsize',12)
text(r,-r-.4,'6','fontsize',12)
text(2*r,-r-.4,'7','fontsize',12)

plot(a(1,:)+r/4,a(2,:)-r+.5,'k','linewidth',1)
text(r/2,1-r,'6','fontsize',12)
plot(a(1,:)+5*r/4,a(2,:)-r+.5,'k','linewidth',1)
text(3*r/2,1-r,'7','fontsize',12)

plot(r+V(1,:),V(2,:)+r,'k','linewidth',1.5)
text(r+.2,0,'4','fontsize',12)
text(r-1,r/2,'4','fontsize',12)

plot(r,0,'ko')
plot(d(1,:)+r-1,d(2,:)-r/4,'k','linewidth',1)
plot(d(1,:)+r-0.5,d(2,:)-r/4+r,'k','linewidth',1)

plot(V(1,:)+2*r,V(2,:)+r/2,'k','linewidth',1.5)
plot([2*r 2*r],[r r/2],'k','linewidth',1.5)
plot([2*r 2*r],-[r r/2],'k','linewidth',1.5)
plot(V(1,:),V(2,:)+r/2,'k','linewidth',1.5)
plot([0 0],[r r/2],'k','linewidth',1.5)
plot([0 0],-[r r/2],'k','linewidth',1.5)
plot(d(1,:)+.5,d(2,:)+r/4,'k','linewidth',1)
plot(d(1,:)+2*r-0.5,d(2,:)+r/4,'k','linewidth',1)

text(2*r-1,0,'5','fontsize',12)
text(r-.1,-r/2,'i_0','fontsize',12)
text(.75,0,'3','fontsize',12)

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




