% Define the circle in 2D theta = linspace(0, 2*pi, 100); % parameter for circle r1 = 0.7*cos(cssangle(995, 1))*tan(cssangle(995, 1)); % radius of the circle z1 = r1 * cos(theta); % x coordinates y1 = r1 * sin(theta); % y coordinates r2 = 0.9*cos(cssangle(995, 3))*tan(cssangle(995, 3)); x2 = r2 * cos(theta); z2 = r2 * sin(theta); r3 = 0.9*cos(cssangle(995, 5))*tan(cssangle(995, 5)); x3 = r3 * cos(theta); y3 = r3 * sin(theta); % Define the center of the circle on the unit sphere % Here, we assume the circle is centered at the north pole (0, 0, 1) of the unit sphere % Convert 2D circle to 3D on the unit sphere phi1 = asin(sqrt(z1.^2 + y1.^2)); % polar angle lambda1 = atan2(y1, z1); % azimuthal angle phi2 = asin(sqrt(x2.^2 + z2.^2)); lambda2 = atan2(z2, x2); phi3 = asin(sqrt(x3.^2 + y3.^2)); lambda3 = atan2(y3, x3); % Convert spherical coordinates to Cartesian coordinates on the unit sphere X1 = cos(phi1); % X coordinates Y1 = sin(lambda1) .* sin(phi1); % Y coordinates Z1 = cos(lambda1) .* sin(phi1); % Z coordinates X2 = sin(lambda2) .* sin(phi2); Y2 = cos(phi2); Z2 = cos(lambda2) .* sin(phi2); X3 = sin(lambda3) .* sin(phi3); Y3 = cos(lambda3) .* sin(phi3); Z3 = cos(phi3); % Plot the unit sphere figure; [Xs, Ys, Zs] = sphere(50); % generate unit sphere surf(Xs, Ys, Zs, 'FaceAlpha', 0.1, 'EdgeColor', 'none'); % plot unit sphere hold on; % Plot the projected circles on the sphere plot3(X1, Y1, Z1, 'r', 'LineWidth', 2); % plot circle 1 plot3(X2, Y2, Z2, 'r', 'LineWidth', 2); % plot circle 2 plot3(X3, Y3, Z3, 'r', 'LineWidth', 2); % plot circle 3 quiver3(0, 0, 0, 1, 0, 0, 'k', 'LineWidth', 2); % X-axis quiver3(0, 0, 0, 0, 1, 0, 'k', 'LineWidth', 2); % Y-axis quiver3(0, 0, 0, 0, 0, 1, 'k', 'LineWidth', 2); % Z-axis text(1, 0, 0, 'X', 'FontSize', 16, 'Interpreter', 'tex', 'Color', 'k') text(0, 1, 0, 'Y', 'FontSize', 16, 'Interpreter', 'tex', 'Color', 'k') text(0, 0, 1, 'Z', 'FontSize', 16, 'Interpreter', 'tex', 'Color', 'k') axis equal; xlabel('X'); ylabel('Y'); zlabel('Z'); title('Circle Projected on Unit Celestial Sphere'); grid on;