Introduction - If you have any usage issues, please Google them yourself
Attitude calculation
Four yuan formula file code is
function dq=MyQuaternion(t,q,Wmx,Wmy,Wmz)
dq=zeros(4,1);
dq(1)=1/2*(-Wmx*q(2)-Wmy*q(3)-Wmz*q(4));
dq(2)=1/2*(Wmx*q(1)+Wmz*q(3)-Wmy*q(4));
dq(3)=1/2*(Wmy*q(1)-Wmz*q(2)+Wmx*q(4));
dq(4)=1/2*(Wmz*q(1)+Wmy*q(2)-Wmx*q(3));