
How to plot multiple ellipsoids on one figure
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to model Plateau–Rayleigh instability in MatLab. This involves plotting a snapshot of water droplets dripping from a sink faucet. Essentially it is a series of ellipsoids who's radii will exponentially decrease in the Z dimension. I'm not exactly sure where to start. I am familiar with the cylinder and ellipsoid commands, however I am not sure how to plot multiple ellipsoids or cylinders on one figure.
Thanks for the help!
댓글 수: 0
답변 (1개)
Anudeep Kumar
2025년 7월 30일
Hello @Max
As far as I understood the question we need to plot a series of ellipsoids whose radii will exponentially decrease in the Z dimension.
Assuming certain parameters like number of droplets, decat factor, distance betwee centers etc. Below is the code.
figure;
hold on
axis equal
colormap('winter')
% Parameters
N = 7; % Number of droplets
z0 = 0; % Starting z-position
dz = 1.2; % Distance between ellipsoid centers
a = 1; % x-radius (fixed)
b = 1; % y-radius (fixed)
c0 = 2; % Initial z-radius
decay = 0.7; % Exponential decay factor for z-radius
% Loop to plot ellipsoids
for k = 1:N
% Calculate current z-radius
c = c0 * decay^(k-1);
% Center position
zc = z0 - (k-1)*dz;
% Ellipsoid surface points
[X,Y,Z] = ellipsoid(0,0,0, a, b, c, 40);
% Shift ellipsoid to its center
surf(X, Y, Z+zc, 'FaceAlpha',0.8, 'EdgeColor','none');
end
xlabel('X'); ylabel('Y'); zlabel('Z');
title('Plateau–Rayleigh Instability: Droplet Chain');
view(3)
hold off
We are using 'surf' function to plot each ellipsoid. 'axis equal' maintains the aspect ratio and 'FaceAlpha' controls the transparency.

Here is the documentation for 'ellipsoid' adn 'surf' function for your reference.
I hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!