% --- Skrip MATLAB untuk Soal: z^2 = x^2 + y^2 dan x^2 + y^2 + z^2 = 16 ---
figure;

% 1. Membuat Bola (x^2 + y^2 + z^2 = 16 -> r = 4)
[X_sphere, Y_sphere, Z_sphere] = sphere(40);
R = 4;
h1 = surf(R*X_sphere, R*Y_sphere, R*Z_sphere);
hold on;
set(h1, 'FaceColor', 'none', 'EdgeColor', [0.3 0.3 0.3], 'LineWidth', 0.4);

% 2. Membuat Permukaan Kerucut (z^2 = x^2 + y^2)
[X_cone, Y_cone] = meshgrid(-4:0.1:4, -4:0.1:4);
Z_cone1 = sqrt(X_cone.^2 + Y_cone.^2);
Z_cone2 = -sqrt(X_cone.^2 + Y_cone.^2);

h2 = mesh(X_cone, Y_cone, Z_cone1);
set(h2, 'EdgeColor', 'k', 'LineWidth', 0.5);

h3 = mesh(X_cone, Y_cone, Z_cone2);
set(h3, 'EdgeColor', 'k', 'LineWidth', 0.5);

% 3. Pengaturan Tampilan Grafik
grid on;
box on;
axis equal; % Supaya bola berbentuk bulat sempurna
axis([-4.5 4.5 -4.5 4.5 -4.5 4.5]);

xlabel('Sumbu x', 'FontSize', 11, 'FontWeight', 'bold');
ylabel('Sumbu y', 'FontSize', 11, 'FontWeight', 'bold');
zlabel('Sumbu z', 'FontSize', 11, 'FontWeight', 'bold');

view(3);
hold off;

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: