function out=f2(d,A1,A2,A3,D1,D2,D3,W1,W2,W3,s1,s2,s3,s4) c=299792.458; %using the determinants to calculate x,y,z x=(-W1-d*D1)/A1; y=(-W2-d*D2)/A2; z=(-W3-d*D3)/A3; %output first equation from 4.37 out=sqrt(((x-s1)^2)+((y-s2)^2)+((z-s3)^2))-c*(s4-d);