玩命加载中 . . .

Matlab字符变量


字符变量

syms a b real;
x = (a + b) ^ 2;
expand(x);  // 展开 a^2 + 2*a*b + b^2

y = (a / 2) ^ 2 / a;    // 自动化简 a/4

z = sin(a) ^ 2 + cos(a) ^ 2;
simplify(z)     // 简化

字符矩阵

A = [0 -z y; z 0 -x; -y x 0];
[V, D] = eig(A);    // 特征值和特征向量
det(A);     // 行列式
A';     // 转置
inv(A)  // 求逆

求旋转矩阵

syms phi theta psi real
Rz = [cos(psi) -sin(psi) 0; sin(psi) cos(psi) 0; 0 0 1];
Ry = [cos(theta) 0 sin(theta); 0 1 0; -sin(theta) 0 cos(theta)];
Rx = [1 0 0; 0 cos(phi) -sin(phi); 0 sin(phi) cos(phi)];
R = Rz * Ry * Rx

[ cos(psi)*cos(theta), cos(psi)*sin(phi)*sin(theta) - cos(phi)*sin(psi), sin(phi)*sin(psi) + cos(phi)*cos(psi)*sin(theta)]
[ cos(theta)*sin(psi), cos(phi)*cos(psi) + sin(phi)*sin(psi)*sin(theta), cos(phi)*sin(psi)*sin(theta) - cos(psi)*sin(phi)]
[         -sin(theta),                              cos(theta)*sin(phi),                              cos(phi)*cos(theta)]
 


文章作者: kunpeng
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 kunpeng !
  目录