clear
clc
vartheta_c=0.1;
fea_c=0.1;
gamma_c=0;
q1=sin(fea_c/2)*sin(vartheta_c/2)*cos(gamma_c/2)+cos(fea_c/2)*cos(vartheta_c/2)*sin(gamma_c/2);
q2=sin(fea_c/2)*cos(vartheta_c/2)*cos(gamma_c/2)+cos(fea_c/2)*sin(vartheta_c/2)*sin(gamma_c/2);
q3=cos(fea_c/2)*sin(vartheta_c/2)*cos(gamma_c/2)-sin(fea_c/2)*cos(vartheta_c/2)*sin(gamma_c/2);
q4=cos(fea_c/2)*cos(vartheta_c/2)*cos(gamma_c/2)-sin(fea_c/2)*sin(vartheta_c/2)*sin(gamma_c/2);
Dt=0.001;
n=1;
t=0;
for i=1:5000
if t<1.5
vartheta_c=vartheta_c;
fea_c=fea_c;
gamma_c=gamma_c;
else
vartheta_c=vartheta_c-Dt*pi/180;
fea_c=fea_c+Dt*pi/180;
gamma_c=gamma_c+Dt*pi/180;
end
q1_c=sin(fea_c/2)*sin(vartheta_c/2)*cos(gamma_c/2)+cos(fea_c/2)*cos(vartheta_c/2)*sin(gamma_c/2);
q2_c=sin(fea_c/2)*cos(vartheta_c/2)*cos(gamma_c/2)
四元数与欧拉角间的转换(源代码)
最新推荐文章于 2024-08-30 12:20:11 发布
这段代码展示了如何在MATLAB中进行四元数与欧拉角之间的转换,并通过动态图形展示转换过程。通过对初始角度的更新,随着时间推移,四元数被转换为欧拉角,并将原始和转换后的角度进行比较。整个过程涵盖了角度的旋转和四元数的动态变化,可用于理解这两种表示方式之间的相互作用。
摘要由CSDN通过智能技术生成