function e = efld( x )
%  return the electric field from three charges located on the x-y plane
%

eps0 = 8.8542e-12;       %  permittivity of free space (Farads/meter)

% charge a
xa = [ 0.0, 0.0 ];       %  location
qa = 1.0;                %  magnitude

% charge b
xb = [ 1.0, 0.0 ];       %  location
qb = 3.0;                %  magnitude

% charge c
xc = [ 0.0, 0.5 ];       %  location
qc = -4.0;               %  magnitude

% calculate relative displacements
ra = x-xa;
ramag = sqrt( ra(1)^2 + ra(2)^2 );   % ra = | x - xa |
rb = x-xb;
rbmag = sqrt( rb(1)^2 + rb(2)^2 );
rc = x-xc;
rcmag = sqrt( rc(1)^2 + rc(2)^2 );

%  calculate electric field
e = ( qa*ra/ramag^3 + qb*rb/rbmag^3 + qc*rc/rcmag^3 )/(4*pi*eps0);
