Solve linear least square problems with non-linear constraints

2 visualizaciones (últimos 30 días)
I currently have a variable vector A in 3x3 and a set of points X in 3xN.
And I want to minimize the || A*X - X'||, where X' is the target point matrix in 3xN also.
However, I have some non-linear constraints where the elements in matrix A should follow:
  1. , ,
  2. , ,
Do any one know which function should I use? Thanks!

Respuesta aceptada

John D'Errico
John D'Errico el 6 de Jun. de 2020
Someone might tell you to use fmincon. And they would be right, in a sense. But they would be missing an important point.
The constraints in 1 imply these points lie on the surface of spheres of unit radius. However, that also means you can write those sets of THREE numbers in the form of TWO angles per set. That is, since you tell us that
a11^2 + a12^2 + a13^2 = 1
then you can transform the problem into a set of 6 angles, instead of 9 numbers. That is, IF we can write a11,a12,a13 as:
a11 = sin(theta1)*cos(phi1)
a12 = sin(theta1)*sin(phi1)
a13 = cos(theta1)
Then they AUTOMATICALLY, IMPLICITLY satisfy those sum of squares constraints. Likewise, we would have:
a21 = sin(theta2)*cos(phi2)
a22 = sin(theta2)*sin(phi2)
a23 = cos(theta2)
a31 = sin(theta3)*cos(phi3)
a32 = sin(theta3)*sin(phi3)
a33 = cos(theta3)
So you really don't need 9 unknowns. You need to estimate 6 unknown angles.
That will still leave you with 3 other equality constraints. They will look like this, when re-written:
cos(theta1)*cos(theta2) + cos(phi1)*cos(phi2)*sin(theta1)*sin(theta2) + sin(phi1)*sin(phi2)*sin(theta1)*sin(theta2) = 0
You will still want to use fmincon to solve the problem. But now it is a problem with 6 unknowns, not 9. And that will make it much more simple to estimate.
  3 comentarios
John D'Errico
John D'Errico el 8 de Jun. de 2020
You cannot use tools like lsqnonlin or lsqcurvefit as I have formulated it in my answer, since there remain nonlinear constraints on the unknowns.
Compute the sum of squares of the errors, returning that to fmincon as the objective function. Supply the remaining constraints as nonlinear constraints, and let it work. You will want to make some guess as to the rotations.
In fact, probably better is to formulate the problem directly as a pure rotation matrix. That really leaves you with only 3 variables, so Euler angles.
With the proper toolbox, you could use quaterions.
Thus, if we look at this as a problem of simple rotations in the form of euler angles, now you could solve it using lsqnonlin, since then all of the constraints are built directly into the matrix, since it becomes a rotation matrix.
Chenxi Li
Chenxi Li el 8 de Jun. de 2020
Thanks for your reply and help!
I solved this optimization problem by building the objective function direcly with 3 angles(unknowns) in sinusoid function using fmincon with no constraints.

Iniciar sesión para comentar.

Más respuestas (1)

James Tursa
James Tursa el 8 de Jun. de 2020
Editada: James Tursa el 10 de Jun. de 2020
If you have two sets of corresponding points from two different coordinate systems and you are simply trying to find the "best" estimated rotation matrix in a least squares sense, see this FEX submission by Matt J:

Categorías

Más información sobre Linear Least Squares en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by