<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.es/matlabcentral/newsreader/view_thread/242369</link>
    <title>MATLAB Central Newsreader - How to solve TA = BT</title>
    <description>Feed for thread: How to solve TA = BT</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.es/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 14 Jan 2009 13:48:01 +0000</pubDate>
      <title>How to solve TA = BT</title>
      <link>http://www.mathworks.es/matlabcentral/newsreader/view_thread/242369#621480</link>
      <author>Pinpress </author>
      <description>Hi all,&lt;br&gt;
&lt;br&gt;
I wonder if there is an existing program that solves the matrix equation: TA = BT, in which T is to be solved, all matrices (T, A, B) are 4-by-4 matrices.  In addition, it is prior information that all matrices are rigid-body transformation matrices, so T only has 12 unknowns. &lt;br&gt;
&lt;br&gt;
Please also note that I have many equations similar to the one given, so:&lt;br&gt;
&lt;br&gt;
T*A1 = B1*T;&lt;br&gt;
T*A2 = B2*T; &lt;br&gt;
...&lt;br&gt;
T*An = Bn*T;&lt;br&gt;
&lt;br&gt;
In all of the equations, T should be the same. So my question is, how to solve T? thanks for any input. </description>
    </item>
    <item>
      <pubDate>Wed, 14 Jan 2009 16:22:02 +0000</pubDate>
      <title>Re: How to solve TA = BT</title>
      <link>http://www.mathworks.es/matlabcentral/newsreader/view_thread/242369#621534</link>
      <author>Per Sundqvist</author>
      <description>"Pinpress" &amp;lt;nospam__@yahoo.com&amp;gt; wrote in message &amp;lt;gkkqeh$idk$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I wonder if there is an existing program that solves the matrix equation: TA = BT, in which T is to be solved, all matrices (T, A, B) are 4-by-4 matrices.  In addition, it is prior information that all matrices are rigid-body transformation matrices, so T only has 12 unknowns. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Please also note that I have many equations similar to the one given, so:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; T*A1 = B1*T;&lt;br&gt;
&amp;gt; T*A2 = B2*T; &lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; T*An = Bn*T;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In all of the equations, T should be the same. So my question is, how to solve T? thanks for any input. &lt;br&gt;
&lt;br&gt;
T=0 is an obvious solution. If you write a vector t=[t11 t12 t13 ...t44]', then you could show that your equation for T is:&lt;br&gt;
&lt;br&gt;
C*t=0&lt;br&gt;
&lt;br&gt;
where Cij=f(A,B) a linear combination of elements in A and B. Could there be another solution than t=[0 0 0 ...0]? Perhaps under special conditions on A and B?&lt;br&gt;
&lt;br&gt;
/Per</description>
    </item>
    <item>
      <pubDate>Mon, 19 Jan 2009 03:27:02 +0000</pubDate>
      <title>Re: How to solve TA = BT</title>
      <link>http://www.mathworks.es/matlabcentral/newsreader/view_thread/242369#622419</link>
      <author>Roger Stafford</author>
      <description>"Pinpress" &amp;lt;nospam__@yahoo.com&amp;gt; wrote in message &amp;lt;gkkqeh$idk$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I wonder if there is an existing program that solves the matrix equation: TA = BT, in which T is to be solved, all matrices (T, A, B) are 4-by-4 matrices.  In addition, it is prior information that all matrices are rigid-body transformation matrices, so T only has 12 unknowns. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Please also note that I have many equations similar to the one given, so:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; T*A1 = B1*T;&lt;br&gt;
&amp;gt; T*A2 = B2*T; &lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; T*An = Bn*T;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In all of the equations, T should be the same. So my question is, how to solve T? thanks for any input. &lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Pinpress, you haven't told us if there is anything special about A and B.  For example, if they, along with T, represent affine three-dimensional transformations in terms of augmented matrices, they would all have [0,0,0,1] in their bottom rows.  The upper left 3x3 part would be a linear transformation and the rightmost top 3x1 part a subsequent translation.  The transformation would be achieved by multiplying a column vector [x;y;z;1] on its left by the matrix as explained in:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Affine_transformation"&gt;http://en.wikipedia.org/wiki/Affine_transformation&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;You would then be taking the difference between 1) an affine transformation A followed by a rotation/translation T, and 2) the rotation/translation T followed by another affine transformation B, and hoping to find a T that would make that difference identically zero.  Moreover this should be done for the same T and many different pairs of A and B.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;As you will see, it is a rather stringent condition that A and B are such that a solution T exists.  Consider just the upper left 3x3 part in A, B, and T, and call them a, b, and t, respectively.  By the nature of such matrices we must have t*a = b*t.  Then take the singular value decomposition of a and b&lt;br&gt;
&lt;br&gt;
&amp;nbsp;[ua,sa,va] = svd(a)&lt;br&gt;
&amp;nbsp;[ub,sb,vb] = svd(b)&lt;br&gt;
&lt;br&gt;
where a = ua*sa*va and b = ub*sb*vb.  Such singular value decompositions into a unitary matrix times a nonnegative diagonal matrix times another unitary matrix are unique (assuming the three singular values are unequal.)  Since we have t*a = b*t, we must have the equality&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;(t*ua)*(sa)*(va) = (ub)*(sb)*(vb*t).&lt;br&gt;
&lt;br&gt;
Here, t being a rotation matrix and therefore a valid unitary matrix, the products t*ua and vb*t are in themselves valid unitary matrices and it follows from the above uniqueness that &lt;br&gt;
&lt;br&gt;
&amp;nbsp;t*ua = ub&lt;br&gt;
&amp;nbsp;sa = sb&lt;br&gt;
&amp;nbsp;va = vb*t&lt;br&gt;
&lt;br&gt;
This shows that we can compute t as t = ub*ua' or t = vb'*va whichever we please.  It also shows that the a and b svd decompositions must satisfy the equality &lt;br&gt;
&lt;br&gt;
&amp;nbsp;va*ua = vb*ub&lt;br&gt;
&lt;br&gt;
and that a and b must have the same singular values in sa and sb.  As I say, A and B must satisfy a very strong condition for any T to possibly exist.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;I leave it to you to work out the details of the problem for the remaining translational aspects of these matrices  - that is, the upper right 3x1 portion of the matrices.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Mon, 19 Jan 2009 16:27:01 +0000</pubDate>
      <title>Re: How to solve TA = BT</title>
      <link>http://www.mathworks.es/matlabcentral/newsreader/view_thread/242369#622543</link>
      <author>Matt </author>
      <description>"Pinpress" &amp;lt;nospam__@yahoo.com&amp;gt; wrote in message &amp;lt;gkkqeh$idk$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I wonder if there is an existing program that solves the matrix equation: TA = BT, in which T is to be solved, all matrices (T, A, B) are 4-by-4 matrices.  In addition, it is prior information that all matrices are rigid-body transformation matrices, so T only has 12 unknowns. &lt;br&gt;
---------------------------------------&lt;br&gt;
&lt;br&gt;
Actually, it has 6, if you parametrize T in terms of 3 Euler angles and 3 translations...&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
---------------------------------&lt;br&gt;
&amp;gt; Please also note that I have many equations similar to the one given, so:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; T*A1 = B1*T;&lt;br&gt;
&amp;gt; T*A2 = B2*T; &lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; T*An = Bn*T;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In all of the equations, T should be the same. So my question is, how to solve T? thanks for any input. &lt;br&gt;
--------------------------------&lt;br&gt;
&lt;br&gt;
In addition to what Roger said, T has 6 degrees of freedom, so if n&amp;gt;6, it is likely that the above system of equations will be overdetermined. So, I'm assuming that what you want is some sort of least squares solution&lt;br&gt;
&lt;br&gt;
(1)  min.  sum_i || T*Ai-Bi*T ||^2   &lt;br&gt;
&lt;br&gt;
If you parameterized T in terms of angles and translations, you could solve this using fmincon(), althrough you would want a good initial guess of T as insurance against local minima.</description>
    </item>
    <item>
      <pubDate>Mon, 19 Jan 2009 18:02:03 +0000</pubDate>
      <title>Re: How to solve TA = BT</title>
      <link>http://www.mathworks.es/matlabcentral/newsreader/view_thread/242369#622567</link>
      <author>Roger Stafford</author>
      <description>"Matt " &amp;lt;mjacobson.removethis@xorantech.com&amp;gt; wrote in message &amp;lt;gl29kl$qn5$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; .......&lt;br&gt;
&amp;gt; In addition to what Roger said, T has 6 degrees of freedom, so if n&amp;gt;6, it is likely that the above system of equations will be overdetermined. So, I'm assuming that what you want is some sort of least squares solution&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; (1)  min.  sum_i || T*Ai-Bi*T ||^2   &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you parameterized T in terms of angles and translations, you could solve this using fmincon(), althrough you would want a good initial guess of T as insurance against local minima.&lt;br&gt;
&amp;gt; .......&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Even with n = 1, it is overdetermined in that sense, Matt.  The equality&lt;br&gt;
&lt;br&gt;
&amp;nbsp;T*A = B*T&lt;br&gt;
&lt;br&gt;
for a single A and B amounts to 12 linear equations to satisfy by itself (ignoring the bottom rows which are always identically equal to [0 0 0 1].)  That is why I said that A and B have to abide by rather stringent conditions for solutions to exist.  In fact, requiring sa = sb (in my earlier notation) represents three constraints and va*ua = vb*ub makes three more, thus leaving six degrees of freedom out of the original twelve for T.  This becomes all the more true for n &amp;gt; 1.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Pinpress's wordage seemed to me to suggest that the Ai and Bi affine transformations arose from some kind of actual measurements that pertained to a real translation plus rotation that was known to exist, and it was only necessary to determine from these measurements just what it was.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;With reference to the least squares approach, I think you meant 'fminunc'.  There would be no constraints in that case with the six parameters - any Euler angles and any displacements are valid cases to be considered in the minimization process.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Mon, 19 Jan 2009 18:26:01 +0000</pubDate>
      <title>Re: How to solve TA = BT</title>
      <link>http://www.mathworks.es/matlabcentral/newsreader/view_thread/242369#622570</link>
      <author>Matt </author>
      <description>"Roger Stafford" &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &amp;lt;gl2f6r$91v$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Matt " &amp;lt;mjacobson.removethis@xorantech.com&amp;gt; wrote in message &amp;lt;gl29kl$qn5$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; .......&lt;br&gt;
&amp;gt; &amp;gt; In addition to what Roger said, T has 6 degrees of freedom, so if n&amp;gt;6, it is likely that the above system of equations will be overdetermined. So, I'm assuming that what you want is some sort of least squares solution&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; (1)  min.  sum_i || T*Ai-Bi*T ||^2   &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; If you parameterized T in terms of angles and translations, you could solve this using fmincon(), althrough you would want a good initial guess of T as insurance against local minima.&lt;br&gt;
&amp;gt; &amp;gt; .......&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Even with n = 1, it is overdetermined in that sense, Matt.  The equality&lt;br&gt;
----------------------------------------------------------------------------------------&lt;br&gt;
&lt;br&gt;
Well, not always. Suppose n=1 and A=B=I. Then the equations reduce simply to&lt;br&gt;
T=T and you have as undetermined a problem as you can get.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt;   With reference to the least squares approach, I think you meant 'fminunc'.  There would be no constraints in that case with the six parameters - any Euler angles and any displacements are valid cases to be considered in the minimization process.&lt;br&gt;
&lt;br&gt;
I suppose. But there's also the possibility that you might wish to constrain the angles to [0,2*pi] to avoid redundant solutions...</description>
    </item>
  </channel>
</rss>
