Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

solving AX=XB for homogeneous transformation matrices...

545 views
Skip to first unread message

FrankieVie

unread,
Dec 3, 2004, 7:52:55 AM12/3/04
to
Hi,

for solving a tool calibration in robotics I have to solve the equation
AX=XB for X in Matlab.
Since this equation is nonlinear it would be nice if I could use a nonlinear
matlab function that minimizes the following eq.:

f(x) = sum(norm(Ra*Rx-Rx*Rb)^2) + sum(norm(Ra*tx+ta - Rx*tb-tx)^2) +
norm(Rx*Rx-I)

where X = [Rx, tx; 0 0 0 1]

Any suggestions?

regards,

Frank van der Velde


Per S

unread,
Dec 3, 2004, 9:58:44 AM12/3/04
to

Hi,

This is an eigenvalue problem!

A*X-X*B=0 is a linear equation in x11,x12,...
but with the RHS=0. So there exist firstly of coures a trivial
solution xij=0.
I can give u the matrix M that corresponds to the equ. M*xx=0,
where xx=[x11 x12 x21 x22] for a 2x2 matrix, if you want. But in
general I don't know how to obtain M. Then you have to solve
[V,D]eig(M) to obtain the non-trivial solutions.

v1=V(:,1);%first solution
X1=reshape(v1,size(X))

Also as previos person argued, the dimension of the equation must
be valid, but I assume A,B,X are all NxN matrices(?).

/Per

Izhak

unread,
Dec 3, 2004, 9:04:29 AM12/3/04
to

Frank,

Not enough details,
I am assuming you are solving AX=XB for X,
if this is true, the equation IS linear.
Mathematically, it is easy to solve it using Kronecker products.

Let vec(A) = A(:) (in Matlab);
Also vec(A*X*B' ) = kron(B,A)*vec(X) (see
http://www.cs.cornell.edu/cv/Research/siamtalk.ps )

Now, if size(X) = [m n]
vec( A*X ) = kron( eye(n) , A) * vec(X)
and
vec ( X*B ) = kron(B', eye(m))*vec(X);
Threfore
AX=XB --> ( kron(eye(n),A) - kron(B,eye(m)) * X(:) = 0,

define Z = ( kron(eye(n),A) - kron(B,eye(m)) ;

All you need is the null space of Z.

Naturally this is not the proper way to solve this equation, let me know if
you are interested and I will write the second half (I got tired).

Hint: see Matlab function Lyap2

HTH

IB
"FrankieVie" <f.vand...@NOSPAMstudent.utwente.nl> wrote in message
news:copnk2$mo8$1...@netlx020.civ.utwente.nl...

Cleve Moler

unread,
Dec 4, 2004, 10:38:18 AM12/4/04
to
In article <copnk2$mo8$1...@netlx020.civ.utwente.nl>,

Hi --

If A and B were known exactly, and if computations could be done exactly,
then A*X = X*B would have a nonzero solution X if and only if
A and B have the same Jordan Canonical Form, J.

inv(V)*A*V = J = inv(W)*B*W

Then X = V*inv(W) would be the solution.

In the presence of errors in A and B, roundoff errors in computation,
and multiple eigenvalues, the problem gets harder. You might try

[V,D] = eig(A)
[W,E] = eig(B)

Find a permutation vector p so that

diag(D) = diag(E(p,p)).

Replace W by W(:,p). Compute

X = V/W

Check to see if A*X is close enough to X*B for your purposes.

Good luck.

-- Cleve
mo...@mathworks.com

0 new messages