필터 지우기
필터 지우기

Plot a cylinder surface with axis along a line

조회 수: 6 (최근 30일)
VINAYAK VINAYAK
VINAYAK VINAYAK 2021년 6월 29일
댓글: VINAYAK VINAYAK 2021년 6월 29일
How do i plot a cylinder with axis along a line? Say for example the axis of the cylinder should be 1,1,1.

답변 (1개)

KSSV
KSSV 2021년 6월 29일
Read about the function cylinder. This will give you cylinder. Define your rotation marix, with the required angle and rotate the cylinder using this matrix.
  댓글 수: 1
VINAYAK VINAYAK
VINAYAK VINAYAK 2021년 6월 29일
Ok so here's the cylinder and final rotation matrix R. Now i want to rotate about x, y, z by 45 deg.(so that axis is along 1,1,1). How do i do that with the arrays (X,Y,Z) that i get from the cylinder function?
r = 10;
[X,Y,Z] = cylinder(r);
syms t
Rx = [1 0 0; 0 cos(t) -sin(t); 0 sin(t) cos(t)];
Ry = [cos(t) 0 sin(t); 0 1 0; -sin(t) 0 cos(t)];
Rz = [cos(t) -sin(t) 0; sin(t) cos(t) 0; 0 0 1];
R = Rx*Ry*Rz;

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by