Minimization falls in wrong minima
1 view (last 30 days)
Show older comments
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
on 10 May 2011
I still don't know what the significance of the fourth component of your coordinates is.
Accepted Answer
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.
More Answers (0)
See Also
Categories
Find more on Coordinate Transformations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!