Plot several cylinders around different centers in the same figure

조회 수: 1 (최근 30일)
Miguel Morgado
Miguel Morgado 2019년 4월 10일
편집: Miguel Morgado 2019년 4월 10일
Hi,
I'm trying to plot several cylinders, trying to avoid using a loop. The centers of these n cylinders are contained in the columns of matrix p_int, of dimensions 3xn. Each of these cylinders should have a height of h_c. Using a loop it would be the code below.
It wold also be great if each cylinder could have the top and bottom 'lids' (circular surfaces) and be translucent. FYI, I'm trying to plot a cylindrical proximity volume around a point in a trajectory every certain time period. Columns in p_int represent this position every timestep. This is going in a figure with other plots, to see if other objects fall inside this proximity cylinder, that's why it would be great if the cylinders could be translucent or something similar.
Thank you very much in advance.
EDIT: The desired result is something similar to the cylinders that are seen in the figure attached.
x0 = p_int(1,:); y0 = p_int(2,:); z0 = p_int(3,:) - h_c/2;
for i=1:length(p_int);
[cx,cy,cz] = cylinder(r_c)
cx = cx + x0(i);
cy = cy + y0(i);
cz = cz*h_c + z0(i)
surf(cx,cy,cz)
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Volume Visualization에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by