Using a vector to plot a cylinder

8 visualizaciones (últimos 30 días)
Thallon Pitchure
Thallon Pitchure el 25 de Jul. de 2019
Comentada: Charles Rice el 15 de Sept. de 2025
Good day,
I am trying to create a cylinder using the 6 data point in the figure provided. The current code is listed below. I am not certain if I am using the correct cylinder syntax. If you could please provided any assistance it would be greatly appreciated. Thank you.
[Z,X,Y] = cylinder(0.0191/2, 100);
rodLen = norm(rodPoints(6,:)-rodPoints(1,:));
surf(X,rodLen*Y,Z,...
'EdgeColor', 'none',...
'FaceColor', [0.7 0.7 0.7],...
'FaceAlpha', 0.2)
  3 comentarios
darova
darova el 28 de Mzo. de 2021
See rotate function
Charles Rice
Charles Rice el 15 de Sept. de 2025
See also atan2d function that does what your if/else statement does.

Iniciar sesión para comentar.

Respuestas (1)

Hari Krishna Ravuri
Hari Krishna Ravuri el 31 de Jul. de 2019
I understand that you are trying to make a surface plot of a cylinder. One of the ways in which you can use cylinder() is
[X,Y,Z] = cylinder(r,n)
This returns x,y,z coordinates of a cylinder based on the parameters. In you script, I observed that, the cylinder’s x,y,z coordinates are being stored in z,x,y . You are trying to modify the y coordinates of the cylinder, which changes the shape of it. Please refer https://www.mathworks.com/help/matlab/ref/cylinder.html

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by