function StereographicCircle(psi) % Compute z-coordinate: z1 = cos(psi); z2 = sin(psi)/tan(psi); % Compute x-y-radius: rz1 = sqrt(1-z1^2); rz2 = sqrt(1-z2^2); % Parametrize x-y-coordinates: phi = 0:0.01:2*pi; np = length(phi); % Compute the circle of lattitude on the sphere: spvec1 = [rz1*cos(phi);rz1*sin(phi);z1*ones(1,np)]; spvec2 = [rz2*cos(phi);rz2*sin(phi);z2*ones(1,np)]; % Compute the stereographic projections: plvec1 = [spvec1(1,:)./(1 - spvec1(3,:));spvec1(2,:)./(1 - spvec1(3,:))]; plvec2 = [spvec2(1,:)./(1 - spvec2(3,:));spvec2(2,:)./(1 - spvec2(3,:))]; % Display the result: figure() scatter(plvec1(1,:),plvec1(2,:)) hold all scatter(plvec2(1,:),plvec2(2,:)) title(sprintf('psi = %e',psi)) end