본문 바로가기
MATLAB 코딩/로봇동역학

<Two Link Manipulator - 2D> 5. 3x3 Rotation 함수 정의

by bigpicture 2019. 7. 1.
반응형

5. 3x3 Rotation 함수 정의


Rotation angle θ 을 입력하면

Rotation matrix를 만들어 주는 matlab 함수를 정의해 봅시다. 


function y=TwoD_RMat(Theta);


y=Rotation_Matrix =...

[...


cosd(Theta) -sind(Theta)     0;...

sind(Theta) cosd(Theta)     0;...

    0          0            1;...

  

];


함수는 m파일로 저장합니다.

해당 m파일이 들어있는 폴더를 matlab 경로에 추가해줍니다. 


함수를 한번 사용해보겠습니다. 

30도 회전시키는 3x3 Rotation matrix를 만들어 봅시다. 


Theta=30;

RotMat1=TwoD_RMat(Theta)


코드를 입력한 결과입니다. 


 

반응형

댓글