Search code examples
matlabsystemequationsinequalities

How to solve a combined set of linear equations and inequalities in Matlab?


I have a problem that involves a system of linear equations and inequalities. The problem is defined by Ax = 0 and Cx > 0 (A and C are matrices, x is a vector of variables to be solved for). This problem likely has a range of solutions. I'd like to find at least one solution or a set of solutions and then choose one out of them. Any ideas how to do this with MATLAB?

For background (not sure this will help though), the vector x contains coefficients for a function which I am trying to determine. The function has known minima (defined by the equality), and another set of constraints for points that have to be above the minima (defined by the inequalities).


Solution

  • If you have the optimization toolbox, you want to use linprog.

    If you don't have the optimization toolbox, use null(A) or svd(A) to find non-trivial solutions to A*x = 0, which allows you to reduce the problem to finding a linear combination of that solution, so that C*x > 0 is satisfied.