how to plot a cute sphere

2 visualizaciones (últimos 30 días)
reza hamzeh
reza hamzeh el 5 de Nov. de 2019
Editada: Adam Danz el 30 de Nov. de 2019
hi. i tried to plot a sphere with sphere function. but the sphere was very ugly. and it was more like an ovoid. plz help me to plot a nice sphere. something like this pic
a=[0 0 0];
[e,f,g] = sphere(30);
e=e*0.3;
f=f*0.3;
g=g*0.3;
s1=surf(e+a(1),f+a(2),g+a(3),'FaceAlpha',0.2,'FaceColor','r')
  1 comentario
KALYAN ACHARJYA
KALYAN ACHARJYA el 5 de Nov. de 2019
I am achieved upto this level, see here
[x,y,z]=sphere;
hSurface=surf(x,y,z);
set(hSurface,'FaceColor',[0 0 0],'FaceAlpha',0.3,'FaceLighting','gouraud','EdgeColor','none')
camlight
axis equal
axis off
789.png

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 5 de Nov. de 2019
Editada: Adam Danz el 30 de Nov. de 2019
If you don't have access to the cuteSphere toolbox, you can just use this line of code below to make the sphere appear as a sphere.
%[your plotting code]
axis equal
The reason your sphere appeared as an ovoid is because the data aspect ratio is not equal.

Más respuestas (0)

Categorías

Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by