关于matlab矩阵乘法的问题
A=[cos(x)0sin(x);010;-sin(x)0cos(x)];B=[cos(y)sin(y)0;-sin(y)cos(y)0;001];这两个矩阵怎么算乘法?...
A=[cos(x) 0 sin(x);0 1 0;-sin(x) 0 cos(x)]; B=[cos(y) sin(y) 0;-sin(y) cos(y) 0;0 0 1]; 这两个矩阵怎么算乘法?
展开
3个回答
展开全部
这个就要根据你的需求了,matlab中矩阵相乘有两种,一种是点乘,即A.*B,还有一种是直接乘,即A*B。点乘是两个矩阵之间对应坐标之间的元素相乘,而直接乘,就是按照矩阵乘法的法则里计算的。
给出源代码如下:
>> syms x y
>> A=[cos(x) 0 sin(x);0 1 0;-sin(x) 0 cos(x)];
>> B=[cos(y) sin(y) 0;-sin(y) cos(y) 0;0 0 1];
>> C1=A.*B;
>> C2=A*B;
>> C1
C1 =
[cos(y) cos(x) 0 0 ]
[ ]
[ 0 cos(y) 0 ]
[ ]
[ 0 0 cos(x)]
>> C2
C2 =
[cos(y) cos(x) cos(x) sin(y) sin(x)]
[ ]
[ -sin(y) cos(y) 0 ]
[ ]
[-sin(x) cos(y) -sin(x) sin(y) cos(x)]
给出源代码如下:
>> syms x y
>> A=[cos(x) 0 sin(x);0 1 0;-sin(x) 0 cos(x)];
>> B=[cos(y) sin(y) 0;-sin(y) cos(y) 0;0 0 1];
>> C1=A.*B;
>> C2=A*B;
>> C1
C1 =
[cos(y) cos(x) 0 0 ]
[ ]
[ 0 cos(y) 0 ]
[ ]
[ 0 0 cos(x)]
>> C2
C2 =
[cos(y) cos(x) cos(x) sin(y) sin(x)]
[ ]
[ -sin(y) cos(y) 0 ]
[ ]
[-sin(x) cos(y) -sin(x) sin(y) cos(x)]
展开全部
syms x y
A=[cos(x) 0 sin(x);0 1 0;-sin(x) 0 cos(x)];
B=[cos(y) sin(y) 0;-sin(y) cos(y) 0;0 0 1];
A*B
输出结果:
[ cos(x)*cos(y), cos(x)*sin(y), sin(x)]
[ -sin(y), cos(y), 0]
[ -cos(y)*sin(x), -sin(x)*sin(y), cos(x)]
A=[cos(x) 0 sin(x);0 1 0;-sin(x) 0 cos(x)];
B=[cos(y) sin(y) 0;-sin(y) cos(y) 0;0 0 1];
A*B
输出结果:
[ cos(x)*cos(y), cos(x)*sin(y), sin(x)]
[ -sin(y), cos(y), 0]
[ -cos(y)*sin(x), -sin(x)*sin(y), cos(x)]
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
> syms x y
>> A=[cos(x) 0 sin(x);0 1 0;-sin(x) 0 cos(x)];
>> B=[cos(y) sin(y) 0;-sin(y) cos(y) 0;0 0 1];
>> A*B
ans =
[ cos(x)*cos(y), cos(x)*sin(y), sin(x)]
[ -sin(y), cos(y), 0]
[ -cos(y)*sin(x), -sin(x)*sin(y), cos(x)]
>> A=[cos(x) 0 sin(x);0 1 0;-sin(x) 0 cos(x)];
>> B=[cos(y) sin(y) 0;-sin(y) cos(y) 0;0 0 1];
>> A*B
ans =
[ cos(x)*cos(y), cos(x)*sin(y), sin(x)]
[ -sin(y), cos(y), 0]
[ -cos(y)*sin(x), -sin(x)*sin(y), cos(x)]
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询