resultant electric field due to a distribution of charges.
[Em,E]=electric_field(xyzc,xyz)
vector of rectangular coordinates of evaluation point, xyz=[x y z]
vector of charge distribution where each row denotes a discrete charge.xyzc=[x y z c] where x,y,z are rectangular coordinates of position of charge and c is its magnitude in coulombs
electric_field(xyzc,xyz) computes the electric field due to a discrete charge distribution. the fuction can also be used for continuous charge distributions by suitably defining charges to be divided over a line, surface or sphere which can be generated.
xyzc=[3 2 -1 10^-3;-1 -1 4 -2*10^-3]; xyz=[0 3 1]; electric_field(xyzc,xyz) xyzc=[2 0 4 5*10^-9;-3 0 5 -2*10^-9]; xyz=[1 -3 7]; electric_field(xyzc,xyz)