Colour depending on the radius of a cylinder.
1 view (last 30 days)
Show older comments
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
Accepted Answer
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
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!