Borrar filtros
Borrar filtros

Rotating a cylinder by 90 degrees

24 visualizaciones (últimos 30 días)
Jonathan Bird
Jonathan Bird el 22 de Mzo. de 2018
Comentada: Julien Cotton el 9 de Feb. de 2021
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?

Respuesta aceptada

Star Strider
Star Strider el 23 de Mzo. de 2018
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 comentario
Julien Cotton
Julien Cotton el 9 de Feb. de 2021
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(:)]';

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by