Colour depending on the radius of a cylinder.

1 view (last 30 days)
The goal is to plot multiple cylinders as a mesh of points with imperfections of the radius, which are generated randomly through MCS. Nevertheless the surf plot assigns the colour according to the height of the points. For better visualization i would like the colour to be dependend on the delta of the radius from the perfect cylinder.
pxI and pyI are matrices with the dimensions (number of points of the circle, number of points along the height, number of simulations) that contain the coordinates including the imperfections of each point.
for i=1:5
figure()
pxI = pxS(:,:,i);
pyI = pyS(:,:,i);
surf(pxI,pyI,pz);
axis equal;
title('Imperfekter Zylinder','FontSize',14)
xlabel('x-Achse [m]','FontSize',14)
ylabel('y-Achse [m]','FontSize',14)
zlabel('z-Achse [m]','FontSize',14)
end
"perfect cylinder"
"imperfect cylinder"
  2 Comments
KSSV
KSSV on 15 Jul 2022
Attach you code which is used to plot the cyclinder (second one).

Sign in to comment.

Accepted Answer

KSSV
KSSV on 15 Jul 2022
Try:
pxI = pxS(:,:,i);
pyI = pyS(:,:,i);
R = sqrt(pxI.^2+pyI.^2) ;
surf(pxI,pyI,pz,R);
  2 Comments
Christoph Bethe
Christoph Bethe on 15 Jul 2022
Thanks. I feel kinda stupid i couldn't find that out myself. But hey that will be an extra point for my homework. :)
KSSV
KSSV on 15 Jul 2022
Thanks is accepting/ voting the answer. :)

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!