//magnetic field estimates due to current flowing in nearby traces
function bz=fieldaxis(I,R,z)
    //the magnetic field along Z axis at the center of a current loop that is away by z from the measurement point, radius R and current I
    //with I in [A], and R,z in [m], bz is in [mG]
    bz=(2*%pi*(R.^2).*I)./((z.^2+R.^2).^(3/2));
endfunction

radius=0.03; //[m] sphere radius
theta=linspace(0,%pi/2-0.1,50); //[rad] angles of coils
current=0.1; //[A] coil current
pcb_thick=0.0001; //[m] thickness separation between opposing current coils

R1=cos(theta).*radius;
R2=cos(theta).*(radius+pcb_thick);
z1=sin(theta).*radius;
z2=sin(theta).*(radius+pcb_thick);

bz1=fieldaxis(current,R1,z1);
bz2=fieldaxis(-current,R2,z2);

bz=bz1+bz2;
plot(theta/%pi*180,bz);
