I have a certain matrix .... How do I know the transformation matrix multiplied by ... if the output is also given as a matrix

4 Comments

How many pairs of known (x,y,z) & (x',y',z') values do you have?
I want program to enter values(x,y,z) & (x',y',z')by function and find the value of transformation matrix that Multiplied by
You need four, not three, pairs of known (x,y,z) & (x',y',z') values. Otherwise, the transformation matrix is not uniquely determined. Given four pairs, you can use matlab's matrix right division (slash) to find the matrix.

Sign in to comment.

Answers (2)

Let v1,v2,v3 be the 3 vectors [x';y';z'] and w1,w2,w3 be the 3 vectors [x;y;z]
Also define
A=[v1-v2, v1-v3, v2-v3 ]/[w1-w2, w1-w3, w2-w3 ];
b=(v1-A*w1);
Then the solution is
H = [A,b;[0 0 0 1]]
"Then the solution is" should read: "then one of infinitely many solutions is." What you have here are twelve equations and sixteen unknowns, so the problem is underdetermined with only three pairs. You could also say a solution is:
[x1',x2',x3';y1',y2',y3';z1',z2',z3';1,1,1] / ...
[x1 ,x2 ,x3 ;y1 ,y2 ,y3 ;z1 ,z2 , z3;1,1,1]
for which I believe matlab gives a least squares solution chosen out of, as I say, infinitely many possible solutions.

2 Comments

Was this meant to be a comment to my Answer?
I'm reading between the lines a bit here, but I don't think there are truly meant to be infinite solutions. Rather, I htink that the question was under-specified. The fact that the vectors multiplied here are of the form [x;y;z;1], plus the fact that only 3 input pairs are available for the problem, suggests that the OP is really trying to represent a 3D affine transformation
[x';y';z'] = A*[x;y;z]+b
in 4D homogeneous coordinates. This means the final matrix has to be of the form
H = [A,b;[0 0 0 1]]
and the idea is to solve for the 3x3 matrix A and 3x1 translation b.
Yes, Matt, you are probably right. It isn't the question Ameer asked, but it may be what was meant.

Sign in to comment.

Categories

Asked:

on 18 Mar 2014

Commented:

on 19 Mar 2014

Community Treasure Hunt

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

Start Hunting!