lsqlin ignores monotonicity constraints for polynomial fit.

1 view (last 30 days)
I'm trying to solve a system Ax = b using lsqlin, where A = [P T] and x =[p; t] and P(rho) is a high order (~10) polynomial with the parameters p. So I use
s = lsqlin(A,b);
and the solver works as expected. This also works when I use some dummy constraints in order to force lsqlin to use qpsub.
Now I want to constrain the polynomial to be monotonic in the range 0 < rho < MAX, so I use the constraint Cx < 0 with C = [-dP 0] and where dP is the derivative of P. This constraint matrix has a few thousand rows so I cover the whole range of rho. Now I use
s = lsqlin(A,b,C,Zeros);
but the resulting polynomial is not monotonic. Checking if the constraints have been met
C*s
several of the values are > 0, violating the constraints.
The only warning I receive is regarding the usage of the medium scale algorithm and according to the lambda.ineqlin output the solution does not lie on a boundary.
What could cause lsqlin to ignore constraints without giving a warning?

Answers (1)

Matt J
Matt J on 12 Oct 2017
The correct test is C*s>TolCon.

Tags

Community Treasure Hunt

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

Start Hunting!