Rotating a cylinder by 90 degrees
19 次查看(过去 30 天)
显示 更早的评论
I've generated a cylinder as follows: [x,y,z]=cylinder([0,10,10,0],100);
z([1,2],:)=0;
z([3,4],:)=100;
mesh(x,y,z)
axis equal; I want to have the cylinder lying flat i.e. a rotation by 90d degrees. I've tried using the rotate function but couldn't get it to work, any suggestions?
0 个评论
采纳的回答
Star Strider
2018-3-23
I don’t understand what your problem with rotate is.
Try these:
[x,y,z]=cylinder([0,10,10,0],100);
z([1,2],:)=0;
z([3,4],:)=100;
figure(1)
hm = mesh(x,y,z);
rotate(hm, [1 0 0], 90)
axis equal
figure(2)
hm = mesh(x,y,z);
rotate(hm, [0 1 0], 90)
axis equal
figure(3)
hm = mesh(x,y,z);
rotate(hm, [1 1 0], 45)
axis equal
1 个评论
Julien Cotton
2021-2-9
Those lines do not work for me : get the following error :
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in rotate (line 49)
tmp =r*[x(:) y(:)]';
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!