function [position_error, emf] = EMF(spherical_coordinates, t_error)
speed_of_light = 299792.458;
speed_of_light_squared = speed_of_light^2;

correct_position = [0, 0, 6370, 0.0001];

[rows, columns] = size(spherical_coordinates);
satellites = zeros(rows, 4);
for i = 1 : rows
	satellite = SphericalToCartesian(spherical_coordinates(i, :));
	for j = 1 : 4
		satellites(i, j) = satellite(j);
    end
    if (mod(floor(rand()*100), 2) == 0)
        satellites(i, 4) = satellites(i, 4) + t_error;
    else
        satellites(i, 4) = satellites(i, 4) - t_error;
    end
end


calculated_position = NewtonsMethodGPS(satellites, [50, 50, 6300, 0.0003], 100);

change_in_position = abs(correct_position - calculated_position);
change_in_position = change_in_position(1:3);
position_error = norm(change_in_position);
emf = abs(max(change_in_position)/(speed_of_light*t_error));

