Set up tolerance and maximal iteration number for lsqlin

11 visualizaciones (últimos 30 días)
Xin
Xin el 26 de Feb. de 2018
Comentada: John D'Errico el 26 de Feb. de 2018
Hello, I have a system of linear equations L*X=R and I try to use lsqlin to get the solution with least square. The system of equations is composed of more equations than the unknowns but there should exist a unique solution to this problem. The question is how should I set up the maximal number of iteration and the tolerance of termination for lsqlin. I tried to use
options = optimoptions('lsqlin','Algorithm','interior-point','MaxIter',10000,'StepTolerance',1e-10);
[X,res] = lsqlin(L,R,[],[],[],[],[],[],[],options);
What I want is to set up an exit tolerance for norm(L*X-R). Is it possible?
Many thanks
  1 comentario
John D'Errico
John D'Errico el 26 de Feb. de 2018
A question I would ask is if you have more equations than unknowns, then why do you expect an exact solution? That would seem to be unusual.
I would also echo Star's comment, as to why you are using lsqlin to solve an unconstrained problem that is trivially solved using backslash, lsqr, pinv, lsqminnorm, etc. Worrying about how to set the parameters on lsqlin seems to suggest that your matrix L is rank deficient. So there are several reasons that suggest lsqlin may be a poor choice of solution method.

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 26 de Feb. de 2018
The lsqlin function is designed solve constrained linear problems. You have specified no constraints, so it would be more appropriate to use the mldivide,\ (link) function, or if you have a sparse system, the lsqr (link) function.
Example
X = L\R;

Más respuestas (0)

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