MATLAB: How do i turn a cylinder to face horizontally in matlab

cylinder

figure('Name','JT Kick Simulation','NumberTitle','off'); set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
radiusbottom = 0.14 heightbottom = 16
[c1X,c1Y,c1Z] = cylinder surf(radiusbottom*c1X+1,radiusbottom*c1Y+1,heightbottom*c1Z+1)
axis([-10 10 -10 10 0 10]);
thats my code and i want it to be 'laying down' instead of standing up

Best Answer

Use the rotate function:
figure('Name','JT Kick Simulation','NumberTitle','off');
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
radiusbottom = 0.14;
heightbottom = 16;
[c1X,c1Y,c1Z] = cylinder;
cyl = surf(radiusbottom*c1X+1,radiusbottom*c1Y+1,heightbottom*c1Z+1); % <— RETURN HANDLE
rotate(cyl, [0 1 0], 90) % <— ADD ‘rotate’ CALL
axis([-10 10 -10 10 0 10]);