how can I plot fluid through the cylinders
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
%t = 0:pi/18:2*pi; y=0:.01:3;x=0:.01:3;
t = 0:pi/20:2*pi; y=0:.01:5;x=0:.01:5;
%[X,Y,Z] = cylinder(.8*(1+.06*sin(5*t)));
[X,Y,Z] = cylinder(.8*(1+.06*sin(5*t)));
surfl(X,Z,Y)
hold on
%[X,Y,Z] = cylinder(1.8*(1+.06*sin(5*t)));
[X,Y,Z] = cylinder(1.8*(1+.06*sin(5*t)));
surfl(X,Z,Y)
%title('$\lambda=5,\epsilon=0.06$','Interpreter','latex','FontSize',11,'FontName','TiemsNewRoman','FontWeight','Normal');
shading interp
colormap(gray);
axis square
axis off
0 Kommentare
Antworten (1)
Shlok
am 30 Mai 2025
Hi Shreen,
To illustrate fluid flow within the cylindrical geometry, an effective approach is to introduce an inner cylinder that represents the fluid. This inner core can be visually distinguished using a different colormap and some transparency, helping it stand out from the outer structure.
For example:
t = 0:pi/20:2*pi;
[Xf, Yf, Zf] = cylinder(0.6 * (1 + 0.06 * sin(5 * t)));
Zf = Zf * 3;
fluid = surf(Xf, Yf, Zf, Zf, 'FaceAlpha', 0.6, 'EdgeColor', 'none');
axis off
To enhance the visualization and simulate fluid motion, animate the inner surface by gradually shifting the phase of the sine wave. This creates a wave-like effect, simulating fluid movement inside the cylinder:
for k = 1:100
[Xf, Yf, Zf] = cylinder(0.6 * (1 + 0.06 * sin(5 * t + 0.1 * k)));
Zf = Zf * 3;
set(fluid, 'XData', Xf, 'YData', Yf, 'ZData', Zf, 'CData', Zf);
drawnow;
end
For more information about the "cylinder" function, refer to the following MathWorks documentation link:
0 Kommentare
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!