- /
-
My Universe
on 1 Dec 2023
- 11
- 35
- 0
- 0
- 510
drawframe(1);
Write your drawframe function below
function drawframe(f)
color1 = [255, 255, 255]./255;
color2 = [255, 192, 203]./255;
color3 = [255, 0, 255]./255;
color4 = [143, 0, 255]./255;
m = [linspace(color4(1), color3(1),24)',...
linspace(color2(2), color2(2),24)',...
linspace(color3(3), color1(3),24)'];
colormatrix = [m; flipud(m)];
set(gcf, 'Color', 'k');
n=25
[x, y, z] = sphere(n);
s = surf(x,y,z)
set(s,'edgecolor','none')
colormap(colormatrix);
hold on
th = 0:pi/50:2*pi;
[x,y] = meshgrid(-2:0.01:2,-2:0.01:2);
z = (1./4.*f).*x.^2+(1./4.*f).*y.^2 < 2;
contour(x,y,z)
axis equal
axis off
view(f, f/1.5);
end