Minimization falls in wrong minima

1 view (last 30 days)
Dear all,
The problem is to charaterize a displacement in the 3D space of an object.
We know the dimension of the object and its inital position (coordinates of all edges).
We also know distances (enough distances) between the oject in the final position and references points (points of known coordinates).
I use so far a rotation and a translation to operate the displacement in space (also one could use quaternion). It is expressed in a 4x4 matrix:
a b c t1
d e f t2
g h i t3
0 0 0 1
I use the function fsolve to minimize the folowing expression:
-distances between the final position of the object and the references points
-conservation of the object dimension (rigid transformation)
- the determinant of the rotation submatrix of the 4x4 matrix should be 1.
Nevertheless I have solutions with exit flag -2 and the object is distorded during transformation (30% of the outputs are wrong). The problem seems to come from the algorithm stability and it tendency to fall in local minima.
Would you know a better way to do this.
The final goal would be to use the algorithm with references points that cannot all provide a solution. In the ideal case the algorithm would only fail for the situations where there is no possible solution.
many thanks
julien
  5 Comments
Andrew Newell
Andrew Newell on 10 May 2011
I still don't know what the significance of the fourth component of your coordinates is.
Julien
Julien on 10 May 2011
Ok for the determinant, thanks. But I am not sure if it is wise to calculate the inv of the matrix for speed consideration. I just thought det=1 is a fast and cheap constraint.
The fourth component is just a trick to have the translation and the rotation together in a same matrix:
http://www.euclideanspace.com/maths/geometry/affine/matrix4x4/index.htm
Withtout the fourth component it is not possible to have a rotation and a translation in a single matrix. One should then use the formula you proposed. Hope that is more clear.
For the quaternion, I would have to use the double quaternions theory if I want to express a rotation and a translation with only quaternions.
Alternatively I could use one carternion and one translation...but then I do not know how to use constraint minimization in matlab with multiple objects.
Thanks you again for the inputs.

Sign in to comment.

Accepted Answer

Andrew Newell
Andrew Newell on 10 May 2011
This problem seems under-constrained. A rotation matrix R should satisfy R.' = inv( R ) and should have a total of three independent parameters. It might be better to use Euler angles to formulate the rotation matrix. Also, why not use a more straightforward expression for the combined translation/rotation?
newCoords = rotationMatrix*oldCoords + translationVector;
When I say that there should be at most three independent parameters in the rotation matrix, that is purely to satisfy the requirement that it be a rotation matrix. Intuitively, any possible rotation can be expressed as three rotations about fixed axes. Any other constraints you have are in addition to this requirement.
If you don't want singularities, quaternions might be a good idea.
EDIT 2: I have just realized that you are trying to solve an optimization problem using fsolve. Use fmincon instead. You can put the constraints into a function like this:
function [~,ceq] = mycon(x)
... % Make the 3d rotation vector R
nonOrthogonality = R.'*R-eye(3);
ceq = [nonOrthogonality(:); det(R)-1];
and set nonlcon = @mycon in the parameters for fmincon.
  1 Comment
Julien
Julien on 11 May 2011
Thank you,
I am going to use this function with the 4x4 matrix and if this does not work I will try the quaternions...

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!