cross product of by an array
12 次查看(过去 30 天)
显示 更早的评论
I have (a )which is an array as below:
a =
a{1} = [185x3 double]
a{2} = [185x3 double]
a{3} = [185x3 double]
a{4} = [185x3 double]
a{5} = [185x3 double]
Also I have (L)which is (5,3) matrix
I need to make cross product as below
(0,0,-2) x a{1} = [185x3 double]
0,0,-1 x a{2} = [185x3 double]
0,0,0) x a{3} = [185x3 double]
0,0,1) x a{4} = [185x3 double]
0,0,2) x a{5} = [185x3 double]
this should result another vectors which I need to quiver3 them
thanks in advance
0 个评论
回答(1 个)
Todd
2020-6-11
You can represent a cross product as a matrix product
a X b = tilde(a)*b
where tilde(a) is a skew-symmetric matrix defined by
tilde = @(v)[
0 -v(3) v(2)
v(3) 0 -v(1)
-v(2) v(1) 0
];
For example
a = [0;0;-1];
b = [1;2;3];
c = tilde(a)*b
b could be a 3xm matrix of column vectors, in which case tilde(a)*b is a crossed with each column of b.
a = [0;0;-1];
b = rand(3,185);
c = tilde(a)*b
Also note that tilde(a)*b = -tilde(b)*a.
My example assumes column vectors, so you'll have to transpose things to apply it to your data.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!