how to span a 3*1 vector into a 3*3 skew symmetric matrix ?

429 ビュー (過去 30 日間)
Stanley Cheng
Stanley Cheng 2014 年 6 月 18 日
編集済み: Thanacha Choopojcharoen 2023 年 10 月 12 日
Hi everyone, as the title,
x=[a b c]' is a 3*1 vector, and its 3*3 skew symmetric matrix is
X=[0 -c b ;
c 0 -a ;
-b a 0 ];
what command is all right to make it in Matlab ?
THX very much!
Cheers
  2 件のコメント
Sachin Goyal
Sachin Goyal 2023 年 2 月 16 日
X = cross([x x x],eye(3))
Thanacha Choopojcharoen
Thanacha Choopojcharoen 2023 年 10 月 12 日
編集済み: Thanacha Choopojcharoen 2023 年 10 月 12 日
I wrote a vectorized version of skew where v can be 3xn or nx3. This will return 3x3xn. Technically, this can be defined as a one-line anonymous function as well.
function S = skew(v)
a = size(v,1)==3;
n = size(v,round(1+a));
V = permute(v,[round(2-a),3,round(1+a)]);
I = repmat(eye(3),[1,1,n]);
S = cross(repmat(V,[1,3]),I);
end

サインインしてコメントする。

採用された回答

Sean de Wolski
Sean de Wolski 2014 年 6 月 18 日
X=[0 -x(3) x(2) ; x(3) 0 -x(1) ; -x(2) x(1) 0 ];
  3 件のコメント
James Tursa
James Tursa 2014 年 6 月 18 日
Take Sean's code and make a function out of it.
John D'Errico
John D'Errico 2014 年 6 月 19 日
A great virtue of MATLAB (ok, almost any programming language) is the ability to write functions that do what you want. Making a skew-symmetric matrix from a vector is not something most people will ever need to do, so it is unlikely you would find a simple command to do it. However, since you can write functions that do anything you want, anything that you will do often, then do so. Personalize your version of MATLAB to include such tools that do what you have a need for.
In this case, a simple m-file would suffice. Or write a function handle if this is not something you will have a need for beyond today.
Finally, the code that Sean gives is easily vectorized to create a 3-d array, where each plane would be one such matrix.

サインインしてコメントする。

その他の回答 (3 件)

Sergei Sergienko
Sergei Sergienko 2020 年 6 月 5 日
編集済み: Sergei Sergienko 2020 年 6 月 5 日
There is special function for this in Matlab called skew
v = [1 2 3]';
skew(v)
ans =
0 -3 2
3 0 -1
-2 1 0
  2 件のコメント
Mitsu
Mitsu 2020 年 12 月 3 日
This function is not included, as of MATLAB 2019b; unless it is part of a specific additional toolbox.
Elyar Zavvari
Elyar Zavvari 2021 年 8 月 12 日
You will find this function in matlab robotics toolbox by Kevin Lynch.

サインインしてコメントする。


Raul Cajias
Raul Cajias 2016 年 4 月 20 日
I think what you're looking for is the skewdec skewed function. However it's only available with the 'Robust Control Toolbox'.

Wit
Wit 2019 年 9 月 15 日
編集済み: Wit 2019 年 9 月 15 日
I think there is a "cross2Matrix" function:
x = [1; 2; 3];
cross2Matrix(x)
ans =
0 -3 2
3 0 -1
-2 1 0

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by