Way to solve AX=XB

45 ビュー (過去 30 日間)
SATISH SONWANE
SATISH SONWANE 2023 年 1 月 25 日
編集済み: Bruno Luong 2023 年 1 月 28 日
Is there any implementation of Tsai and lenz's (Or any other) method for solving AX=XB for hand- Eye Calibration?

回答 (3 件)

the cyclist
the cyclist 2023 年 1 月 25 日
This is a special case of the Sylvester equation.
Looks like the sylvester function will be helpful for you.
You might also be interested in this blog post on the topic by Cleve Moler.
  1 件のコメント
SATISH SONWANE
SATISH SONWANE 2023 年 1 月 28 日
Sorry. That didn't help.

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


Torsten
Torsten 2023 年 1 月 28 日
編集済み: Torsten 2023 年 1 月 28 日
dim = 4;
X = sym('X',[dim dim]);
A = rand(dim);
B = A.';
[M, ~] = equationsToMatrix(A*X==X*B)
if rank(M) < size(A,1)^2
N = null(M);
for i = 1:size(N,2)
S{i} = reshape(N(:,i),size(X));
S{i}
A*S{i}-S{i}*B
end
end

Matt J
Matt J 2023 年 1 月 28 日
編集済み: Matt J 2023 年 1 月 28 日
[ma,na]=size(A);
[mb,nb]=size(B);
%size(X)=[na,mb]
X=null( kron(speye(mb),A) - kron(B.',speye(na)) );
X=reshape(X,na,mb,[]);
  2 件のコメント
the cyclist
the cyclist 2023 年 1 月 28 日
I couldn't get this method to work. Am I overlooking something dumb?
rng default
A = rand(5);
B = rand(5);
[ma,na]=size(A);
[mb,nb]=size(B);
X=null( kron(speye(mb),A) - kron(B.',speye(na)) );
Error using svd
SVD does not support sparse matrices. Use SVDS to compute a subset of the singular values and vectors of a sparse matrix.

Error in null (line 75)
[V, s] = svd(A','vector');
X=reshape(X,na,mb,[]);
Bruno Luong
Bruno Luong 2023 年 1 月 28 日
編集済み: Bruno Luong 2023 年 1 月 28 日
null can only work wth full matrix
rng default
A = rand(5);
XX = rand(5);
B = XX\(A*XX);
[ma,na]=size(A);
[mb,nb]=size(B);
K=null( kron(eye(mb),A) - kron(B.',eye(na)));
R = rand(size(K,2),1); % Any random vector with this size will do the job
X = reshape(K*R,[na,mb])
X = 5×5
0.1100 0.1626 0.0772 -0.0458 0.0810 -0.0536 -0.3884 0.0510 0.0552 -0.0602 0.1937 -0.1993 0.3240 0.3508 -0.0352 -0.1165 0.4388 -0.3413 -0.3089 0.1851 0.0500 0.0277 0.0913 0.1389 0.0450
norm(A*X-X*B)
ans = 7.4501e-16

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

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by