
How to plot multiple ellipsoids on one figure
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Anudeep Kumar
el 30 de Jul. de 2025
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 comentarios
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!