Plot several cylinders around different centers in the same figure

3 views (last 30 days)
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

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!