Borrar filtros
Borrar filtros

Two surf plots in the same figure

6 visualizaciones (últimos 30 días)
Radhi
Radhi el 3 de Sept. de 2023
Editada: Voss el 3 de Sept. de 2023
When trying to plot two surf plots in the same figure, surf plots are not displaying. The problem seems as if the axes limits are not getting updated as per the set values. Kindly help me to solve this problem. The following is the code.
figure;
ax = gca;
ax.XLimMode = 'manual';
xlim([-10000 10000]);
ylim([-10000 10000]);
zlim([-10000 10000]);
ra = 0.5;
r1 = [4.662840968803412 -0.597125750259697 -5.446916224720714]*10^03;
r2 = [0.662840968803412 -4.597125750259697 -5.446916224720714]*10^03;
[X1 Y1 Z1] = ellipsoid(r1(1),r1(2),r1(3),ra,ra,ra);
[X2 Y2 Z2] = ellipsoid(r2(1),r2(2),r2(3),ra,ra,ra);
surf(X1,Y1,Z1); hold on;
plot3(r2(1),r2(2),r2(3),'*m'); hold on;
surf(X2,Y2,Z2);

Respuesta aceptada

Voss
Voss el 3 de Sept. de 2023
Editada: Voss el 3 de Sept. de 2023
"seems as if the axes limits are not getting updated as per the set values"
Set the axes limits after plotting:
figure;
ra = 0.5;
r1 = [4.662840968803412 -0.597125750259697 -5.446916224720714]*10^03;
r2 = [0.662840968803412 -4.597125750259697 -5.446916224720714]*10^03;
[X1 Y1 Z1] = ellipsoid(r1(1),r1(2),r1(3),ra,ra,ra);
[X2 Y2 Z2] = ellipsoid(r2(1),r2(2),r2(3),ra,ra,ra);
surf(X1,Y1,Z1); hold on;
plot3(r2(1),r2(2),r2(3),'*m');
surf(X2,Y2,Z2);
xlim([-10000 10000]);
ylim([-10000 10000]);
zlim([-10000 10000]);
Note that the axes limits are correct, but you don't see the ellipsoids because they are so small (radius = 0.5; axes-limits = [-10000 10000]). If you were to increase their radius, you'd see them:
figure;
ra = 5000;
r1 = [4.662840968803412 -0.597125750259697 -5.446916224720714]*10^03;
r2 = [0.662840968803412 -4.597125750259697 -5.446916224720714]*10^03;
[X1 Y1 Z1] = ellipsoid(r1(1),r1(2),r1(3),ra,ra,ra);
[X2 Y2 Z2] = ellipsoid(r2(1),r2(2),r2(3),ra,ra,ra);
surf(X1,Y1,Z1); hold on;
plot3(r2(1),r2(2),r2(3),'*m');
surf(X2,Y2,Z2);
xlim([-10000 10000]);
ylim([-10000 10000]);
zlim([-10000 10000]);

Más respuestas (0)

Categorías

Más información sobre Axes Appearance en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by