%% Cartesian to Spherical Coordinates
% Convert the Cartesian coordinates defined by corresponding entries in the matrices x, y, and z to spherical coordinates az, el, and r. These points correspond to the eight vertices of a cube.

x = [1 1 1 1; -1 -1 -1 -1]

%

y = [1 1 -1 -1; 1 1 -1 -1]

%

z = [1 -1 1 -1; 1 -1 1 -1]

%

[az,el,r] = cart2sph(x,y,z)

% Copyright 2012 The MathWorks, Inc.