Any commands about rotation where the unit of the input is radian

조회 수: 9 (최근 30일)
Tony Cheng
Tony Cheng 2025년 6월 9일
답변: Paul 2025년 6월 9일
Hi there,
We find in Matlab, the command rotx denotes a rotation matrix around the x-axis by ang degrees, and the unit of the input is degree.
Here I want to ask, are there any commands that the unit of the input is radian?
Many thanks!

채택된 답변

the cyclist
the cyclist 2025년 6월 9일
I don't think there is a native equivalent of rotx() that uses radian as input. You can convert radians to degrees using the rad2deg function. You could write your own rotx_rad() function that incorporates that automatically.
function R = rotx_rad(theta_rad)
% Rotation matrix about the x-axis (input in radians)
% R = rotx_rad(theta_rad) returns the 3×3 rotation matrix for a rotation
% of theta_rad radians about the x-axis.
% Convert radians to degrees and call rotx()
R = rotx(rad2deg(theta_rad));
end

추가 답변 (1개)

Paul
Paul 2025년 6월 9일
eul2rotm and angle2dcm both ingest angle inputs in radians, but they both require three angles on input. Also, care must be taken when using the output because the functions return different matrices.
eul2rotm([pi/4,0,0])
ans = 3×3
0.7071 -0.7071 0 0.7071 0.7071 0 0 0 1.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
angle2dcm(pi/4,0,0)
ans = 3×3
0.7071 0.7071 0 -0.7071 0.7071 0 0 0 1.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by