冬季的期盼 发表于 2013-7-19 15:21

matlab如何计算带三角符号函数的矩阵?

比如
*
    两个矩阵相乘
首先θ是变量,能不能不赋值输入
另外就是结果的三角函数有没有可能自己化简,比如sin^2+cos^2=1
化简可以不要,主要问题是怎么能把变量输进去

袁海亮 发表于 2013-7-20 09:43

只要定义符号变量theta就可以,使用sym()定义。theta定义为符号变量,sin(theta)就是一个符号函数了{:soso_e100:}

百年孤独 发表于 2013-7-20 10:22


syms theta1;
A=
B=
C=A*B
D=simple(C)
运行结果:
A =
[  sin(theta1), -cos(theta1),            0]
[  cos(theta1),  sin(theta1),            0]
[                  0,                 0,            1]
B =
[  cos(theta1), -sin(theta1),            0]
[  sin(theta1),  cos(theta1),            0]
[                   0,                0,            1]
C =
[                                            0, -sin(theta1)^2-cos(theta1)^2,                            0]
[  cos(theta1)^2+sin(theta1)^2,                                            0,                            0]
[                                           0,                                             0,                            1]
D =
[  0, -1,  0]
[  1,  0,  0]
[  0,  0,  1]

百年孤独 发表于 2013-7-20 10:23

用syms定义一下
页: [1]
查看完整版本: matlab如何计算带三角符号函数的矩阵?