MATLAB: Plot cylinder symmetry axis

axisComputer Vision ToolboxcylinderMATLABplot

I am using the function cylinder to generate a cylinder model. I would like to show the cylinder axis in my plot.
There is a function to rapidly plot the axis or i have to necessary build it and than plot ?

Best Answer

I am not certain what you intend by ‘axis’.
If you just want a line through the axis of the cylinder, try this:
[X,Y,Z] = cylinder;
figure
surf(X, Y, Z)
hold on
plot3([0 0], [0 0], [-1 2], ':r', 'LineWidth',2)
hold off
grid on
Experiment to get the result you want.