function y = spheres(x, C1, C2, C3, R1, R2, R3)

% Objective function for solving 
% three simultaneous spherical equations.
% Spheres i = 1:3 have centers Ci and radii Ri.
% For use with the plotting routine in threespheres.m.

y = ...
    [(x(1) - C1(1))^2 + (x(2) - C1(2))^2 + (x(3) - C1(3))^2 - R1^2;
    (x(1) - C2(1))^2 + (x(2) - C2(2))^2 + (x(3) - C2(3))^2 - R2^2;
    (x(1) - C3(1))^2 + (x(2) - C3(2))^2 + (x(3) - C3(3))^2 - R3^2];