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

📄 rotvec.m

📁 数值方法和MATLAB实现与应用.zip
💻 M
字号:
function  v = rotvec(u,alpha,beta,zeta)
% rotvec  Rotates a three dimensional vector
%
% Synopsis:  v = rotvec(u,alpha,beta,zeta)
%
% Input:     u     = initial vector
%            alpha = angle, in degrees, of rotation about the x-axis
%            beta  = angle, in degrees, of rotation about the y-axis
%            zeta  = angle, in degrees, of rotation about the z-axis
%
%  Output:  v = final vector, i.e. result of rotating u through
%               the angles alpha, beta and zeta

a = alpha*pi/180;  b = beta*pi/180;  z = zeta*pi/180;  % convert to radians

% --- set up rotation matrices
Rx = [ 1  0  0; 0  cos(a)  -sin(a); 0  sin(a)  cos(a)];
Ry = [ cos(b)  0  sin(b);  0  1  0; -sin(b)  0  cos(b) ];
Rz = [ cos(z) -sin(z)  0;  sin(z)  cos(z)  0;  0  0  1 ];

v = Rz*Ry*Rx*u;          %  apply the rotation

⌨️ 快捷键说明

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