% see http://tools.crocus-technology.com:5010/MF_CAL % note that a and b are reversed! I = 20; mu0 = 4e-7*pi; a = 10e-3; b = 2e-3; Bx = @(x, y) mu0*I/(4*pi*a*b) * integral3(@(xs, ys, zs) -(y-ys)./(((x-xs).^2 + (y-ys).^2 + zs.^2).^(3/2)), -a/2, a/2, -b/2, b/2, -inf, inf, 'AbsTol',1e-3); By = @(x, y) mu0*I/(4*pi*a*b) * integral3(@(xs, ys, zs) (x-xs)./(((x-xs).^2 + (y-ys).^2 + zs.^2).^(3/2)), -a/2, a/2, -b/2, b/2, -inf, inf,'AbsTol',1e-3); B = @(x,y) [Bx(x,y); By(x,y)]; B(0, 11e-3) % x = (-7:7)*1e-3; % y = (-4:4)*1e-3; % BB = []; % % % for u=1:length(x) % for v=1:length(y) % BB = [BB [x(u); y(v); B(x(u),y(v))]]; % % figure(1); % quiver(BB(1,:), BB(2,:), BB(3,:), BB(4,:)); % drawnow % end % end % % figure(1); % rectangle('Position', [-a/2 -b/2 a b])