function vykresliPoleKondenzatoru(a,b,tau,x0,x1,y0,y1,h)

% vykresliPoleKondenzatoru(a,b,tau,x0,x1,y0,y1,h)
%           vykresli pole dvou paralelnich liniovych naboju {-a}x[-b,b] a
%           {a}x[-b,b], kde tau je liniova hustota naboje,
%           x0,x1,y0,y1,h ... specifikace site pro quiver.


x = x0:h:x1;
y = y0:h:y1;
[X,Y] = meshgrid(x,y);
M = 1e-6*ones(size(X));

epsilon0 = 8.854e-12;

sqrtMinus1 = sqrt((X+a).^2+(Y+b).^2);
sqrtMinus2 = sqrt((X+a).^2+(Y-b).^2);
sqrtPlus1 = sqrt((X-a).^2+(Y+b).^2);
sqrtPlus2 = sqrt((X-a).^2+(Y-b).^2);

EX = -(tau/(4*pi*epsilon0)) * ( (Y+b)./((X+a).*sqrtMinus1) - (Y-b)./((X+a).*sqrtMinus2) );
EX = EX + (tau/(4*pi*epsilon0)) * ( (Y+b)./((X-a).*sqrtPlus1) - (Y-b)./((X-a).*sqrtPlus2) );

EY = (tau/(4*pi*epsilon0)) * ( 1./sqrtMinus1 - 1./sqrtMinus2 );
EY = EY - (tau/(4*pi*epsilon0)) * ( 1./sqrtPlus1 - 1./sqrtPlus2 );

E = sqrt(EX.^2+EY.^2);
EX = EX ./ E;
EY = EY ./ E;

contour(X,Y,E)
hold on
quiver(X,Y,EX,EY)
hold off
axis image
