%
% wbridge.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([0 0],[1/sqrt(2) r],'k','linewidth',1.5)
hold on
plot([0 0],[-1/sqrt(2) -r],'k','linewidth',1.5)
plot([0 2*r],[r r],'k','linewidth',1.5)
t = 0:.01:2*pi;
plot(cos(t)/sqrt(2),sin(t)/sqrt(2),'k','linewidth',1.5)
text(-.2,-.1,'V_1','fontsize',12)
plot(r+V(1,:),V(2,:),'k','linewidth',1.5)
plot(r+V(1,:),V(2,:)+r,'k','linewidth',1.5)
text(r+.2,0,'x_1','fontsize',12)
text(r-1,r/2,'y_1','fontsize',12)
text(r-1,-r/2,'y_2','fontsize',12)
text(r+1/2,r/2,'R','fontsize',12)
text(r+1/2,-r/2,'R','fontsize',12)
plot(r,0,'ko')
plot(d(1,:)+r-0.5,d(2,:)-r/4,'k','linewidth',1)
plot(d(1,:)+r-0.5,d(2,:)-r/4+r,'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(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(V(1,:)+2*r,V(2,:)+r,'k','linewidth',1.5)
plot(d(1,:)+2*r-0.5,d(2,:)-r/4+r,'k','linewidth',1)
text(2*r+.2,0,'x_2','fontsize',12)
plot(2*r,0,'ko')

text(2*r-1,r/2,'y_3','fontsize',12)
text(2*r-1,-r/2,'y_4','fontsize',12)
text(2*r+1/2,r/2,'R_3','fontsize',12)
text(2*r+1/2,-r/2,'R','fontsize',12)


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




