disp('Enter the observatioon point (in the'); p0 = input(�format [x y z]... \n > ');
if isempty(p0); p0 = [0 0 0]; end
xpstart = 0; xpend = 1e-2; % start and end points for
% integration variable x prime dxp=1e-7; % integration variable increment dx
H = [0, 0, 0]; % initial field values before integration sum
zp = 0; % current lies only in the xy plane
for xp=xpstar:dx:xpend; % begin integration loop
xp=xp^2*1e2; % make substation for y prime in terms % of x prime % the 1e3 is to offset the 1e-2 squared % term which relates x prime and y prime % in space dyp=2*x*dxp; % make substitution for dy prime in terms % of dx prime
num = [(p0(3)-zp)*dyp,-((p0(3)-zp)*dxp,((p0(2)-yp)*dxp-... (p0(1)-xp)*dyp)]; % numerator den = ((p0(1)-xp)^2+(p0(2)-yp)^2)^(3/2); % denominator
end
H=H*I/(4*pi);
% display the output
disp('') disp(�The magnetic field at '); disp(sprintf('(%f, %f, %f) cm \nis (%f %f %f) A/m', ... p0(1), p0(2), p0(3), H(1), H(2), H(3)))