Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

lsqlin ignores monotonicity constraints for polynomial fit.

Asked by Oliver

Oliver (view profile)

on 19 Sep 2013

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


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?



Oliver (view profile)


0 Answers

Contact us