How to show a deformation of a sphere

조회 수: 5 (최근 30일)
Daniele Cuomo
Daniele Cuomo 2020년 6월 18일
댓글: Simson Hutagalung 2022년 6월 24일
I want to show a function that take a sphere with radius 1 as input and that gives in output an ellipsoid with axes always lower then 1.
tiledlayout(1,2);
[X, Y, Z] = ellipsoid(0,0,0,1,1,1,40);;
surf(nexttile,X,Y,Z);
axis equal;
title('Before')
mesh(nexttile,X/2,Y/2,Z/2);
axis equal
title('Then')
The problem with this code is that, instead of seeing a deformation of the sphere I get an adaptation of the axis. I'd like to fix the axes to be unitary for both the subfigures.
  댓글 수: 3
Daniele Cuomo
Daniele Cuomo 2020년 6월 18일
Yes! But in two different subplots.
Simson Hutagalung
Simson Hutagalung 2022년 6월 24일
How to generate deformation colormap 2D in matlab with data from excel?

댓글을 달려면 로그인하십시오.

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2020년 6월 18일
Keep track of the x, y, and z-lims or the axis-limits. Something like this:
tiledlayout(1,2);
[X, Y, Z] = ellipsoid(0,0,0,1,1,1,40);;
surf(nexttile,X,Y,Z);
axis equal;
ax1 = axis;
title('Before')
mesh(nexttile,X/2,Y/2,Z/2);
axis equal
title('Then')
axis(ax1)
You might have to do the same for the viewing-angles too, but the same procedure applies.
HTH

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by