function out = jf(w)
%Jacobian of S.m

%break the input into x,y,z,d
x = w(1);
y = w(2);
z = w(3);
d = w(4);

A1 = 15600; %the four satellite positions
B1 = 7540;  %Everything in kilometers
C1 = 20140;
A2 = 18760;
B2 = 2750;
C2 = 18610;
A3 = 17610;
B3 = 14630;
C3 = 13480;
A4 = 19170;
B4 = 610;
C4 = 18390;

c = 299792.458; %speed of light in kilometers/seconds

%measured time intervals in seconds
t1 = .07074;
t2 = .07220;
t3 = .07690;
t4 = .07242;

s11 = 2*(x-A1);
s12 = 2*(y-B1);
s13= 2*(z-C1);
s14 = 2*(c^2)*(t1-d);

s21 = 2*(x-A2);
s22 = 2*(y-B2);
s23 = 2*(z-C2);
s24 = 2*(c^2)*(t2-d);

s31 =2*(x-A3);
s32 = 2*(y-B3);
s33 = 2*(z-C3);
s34 = 2*(c^2)*(t3-d);

s41= 2*(x-A4);
s42 = 2*(y-B4);
 s43 = 2*(z-C4);
 s44 = 2*(c^2)*(t4-d);


out = [s11, s12, s13, s14; s21,s22,s23, s24; s31,s32,s33, s34; s41,s42,s43, s44];


end

