function [E,V] = CampoPotencial(q,rq,re)

% Electric field and potential of a point charge
% Solution to problem 3, control 1, Nov.2016
% J.M.Soler
% Input:
%   q     : charge value (C)
%   rq(3) : charge coordinates (m)
%   re(3) : test-point coordinates (m)
% Output:
%   E(3)  : electric field (V/m)
%   V     : electric potential (V)

  kc = 9.0e9;  % Coulomb constant kc=1/4/pi/eps0
  rqe = sqrt(sum((re-rq).^2));  % distance to charge
  E = kc*q*(re-rq)/rqe^3;
  V = kc*q/rqe;
  
end
