⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rotdemo.m

📁 This diskette (version 1.0) contains demonstration programs and source codes in MATLAB (v.5.2) for a
💻 M
字号:
%
% computes quaternions of rotation about [111] axis
%
clear all;
close all;
rate     = (pi/sqrt(3)/5)*[1;1;1];  % rotation rate vector (rad/sec)
timestep = .001;    % time step in seconds
Nsteps   = 1000;   % number of time steps to simulate
rotvec   = timestep*rate;
q        = rotvec2qvec(rotvec);
Q        = qvec2mat(q);
%
Px       = qvec2mat([0;1;0;0]);
Py       = qvec2mat([0;0;1;0]);
Pz       = qvec2mat([0;0;0;1]);
for k=1:Nsteps
   t(k)   = timestep*(k-1);
   Px     = Q*Px/Q;
   Py     = Q*Py/Q;
   Pz     = Q*Pz/Q;
   M      = [Px(2:4,1),Py(2:4,1),Pz(2:4,1)];
   m11(k) = M(1,1);
   m12(k) = M(1,2);
   m13(k) = M(1,3);
   m21(k) = M(2,1);
   m22(k) = M(2,2);
   m23(k) = M(2,3);
   m31(k) = M(3,1);
   m32(k) = M(3,2);
   m33(k) = M(3,3);
end;
figure;
subplot(3,1,1),plot(t,m11,'k-',t,m12,'k--',t,m13,'k:');
title('Direction Cosines during Rotation about [111]');
ylabel('1st Row');
legend('Col 1','Col 2','Col 3');
subplot(3,1,2),plot(t,m21,'k-',t,m22,'k--',t,m23,'k:');ylabel('2nd Row');
subplot(3,1,3),plot(t,m31,'k-',t,m32,'k--',t,m33,'k:');ylabel('3rd Row');xlabel('Time [sec]');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -