Solving Linear Matrix Inequalities (LMI) with MATLAB

Linear matrix inequalities are a core tool in control systems, optimization, and many engineering fields.

1. What is a Linear Matrix Inequality?

Linear matrix inequality refers to inequalities of the following form:

Where:

  • is the decision variable (a vector) we need to solve for.
  • is a given symmetric matrix.
  • indicates that the matrix is negative definite. This means that for all non-zero vectors , we have . Equivalently, all eigenvalues of are negative.

The meaning of “linear”: Although we are dealing with matrices, “linear” refers to the fact that the dependence of the matrix on the decision variable is linear. The content of the matrix itself varies linearly with .

2. General Forms and Common Types of LMI

  1. Strict LMI:
  2. Non-strict LMI: (negative semi-definite)
  3. General form of LMI systems: can contain multiple LMIs simultaneously, as they can be combined into a larger LMI.

Some very important specific LMIs:

  • Lyapunov Inequality: Very well-known in system stability analysis.

    Where is the known system matrix, (symmetric positive definite matrix) is the decision variable. This LMI is equivalent to the linear system being asymptotically stable.

  • Matrix Inequality Form: Sometimes the problem may present in a more complex form, but can be transformed into a standard LMI using the Schur Complement Lemma. Schur Complement Lemma: For symmetric matrices , the following three conditions are equivalent:

  1. and
  2. and This lemma can transform nonlinear matrix inequalities (such as those involving ) into linear matrix inequalities concerning the original matrix blocks.

3. How to Solve LMI?

LMI problems typically do not seek an “analytical solution,” but rather find a feasible solution or optimal solution through numerical methods.

The core idea: LMI defines a convex constraint set in the decision variable space. That is, if and both satisfy the LMI, then any point on the line connecting them also satisfies the LMI. The convexity allows us to use very efficient interior-point methods to solve.

Solution Process:

  1. Problem Modeling: Formulate your engineering problem (such as stability, robust control, filter design) as one or more LMIs.
  2. Select Solver: Use specialized numerical solving software.
  3. Programming Implementation: Define decision variables, constraints (LMIs), and objective functions in the software.
  4. Numerical Solving: Run the solver.
  5. Result Analysis: Verify whether the solution meets the requirements and extract the desired controller gains or system parameters.

4. Commonly Used Solving Tools (Software)

Here are some of the most commonly used tools in industry and academia:

1. MATLAB LMI Toolbox / Robust Control Toolbox

This is the most mainstream choice.

  • Early Specialized Tools: <span>lmitool</span>, <span>feasp</span>, <span>mincx</span>, <span>gevp</span>, etc. These functions are relatively low-level and require users to define the LMI system in a specific format.
  • YALMIP (Highly Recommended): A powerful MATLAB modeling toolbox that serves as a frontend to call various backend solvers. Its syntax is very intuitive and easy to use.Example (Using YALMIP to Solve Lyapunov Inequality):
    % Define known matrix A
    A = [0, 1; -2, -3];
    
    % Define decision variable: symmetric positive definite matrix P
    P = sdpvar(2, 2, 'symmetric');
    
    % Define LMI constraints
    Constraints = [P >= 0]; % Positive definite constraint
    Constraints = [Constraints, A'*P + P*A <= -eye(2)]; % Lyapunov inequality, here using <= -I to ensure < 0
    
    % Define objective function (for feasibility problems, the objective can be set to a constant, e.g., 0)
    Objective = 0;
    
    % Solve
    optimize(Constraints, Objective);
    
    % Check solution results and get the value of P
    if problem == 0
        P_solution = value(P)
        eig_P = eig(P_solution) % Check if P is positive definite
        eig_Lyap = eig(A'*P_solution + P_solution*A) % Check if the Lyapunov matrix is negative definite
    else
        disp('No feasible solution found.');
    end
    
  • CVX: Another popular MATLAB modeling system, especially suitable for convex optimization, also supports LMI.

2. Python Ecosystem

Python is becoming increasingly powerful in scientific computing and optimization.

  • CVXPY: Similar to MATLAB’s CVX, it is a convex optimization modeling tool for Python.Example (Using CVXPY to Solve the Same Lyapunov Inequality):
    import cvxpy as cp
    import numpy as np
    
    # Define known matrix A
    A = np.array([[0, 1], [-2, -3]])
    
    # Define decision variable: symmetric positive definite matrix P
    P = cp.Variable((2, 2), symmetric=True)
    
    # Define constraints
    constraints = [P >> 0]  # Positive definite constraint
    constraints += [A.T @ P + P @ A << -np.eye(2)]  # Lyapunov inequality
    
    # Define problem (feasibility problem)
    prob = cp.Problem(cp.Minimize(0), constraints) # Minimize objective function 0
    
    # Solve
    prob.solve()
    
    # Output results
    if prob.status == 'optimal':
        P_solution = P.value
        print("P found:\n", P_solution)
        # Further check eigenvalues
    else:
        print("Solution not found.")
    
  • SciPy: For small-scale problems, sometimes <span>scipy.optimize.minimize</span> can be used along with a custom constraint function (transforming negative definiteness constraints into all eigenvalues being less than 0), but this is usually not as efficient and stable as dedicated LMI solvers.

3. Dedicated Solvers (Usually Called by YALMIP/CVXPY)

  • SeDuMi
  • SDPT3
  • MOSEK (commercial software, powerful performance)

5. Application Example: State Feedback Controller Design

A classic problem is to find a state feedback control law that stabilizes the closed-loop system . This can be transformed into the following LMI problem:

Find matrices and such that:

If this LMI has a solution, then the controller gain is , and is the solution to the Lyapunov equation.

Summary

Step Key Content Recommended Tools
1. Modeling Transform the problem into LMI form, using Schur complement lemma if necessary. Pencil and paper derivation
2. Programming Define variables and constraints using an intuitive modeling language. YALMIP (MATLAB) or CVXPY (Python)
3. Solving Call efficient interior-point method solvers to compute numerical solutions. MOSEK, SeDuMi, SDPT3 (usually called automatically by frontend tools)
4. Verification Check the positive/negative definiteness of the solution, calculate controller gains, etc. MATLAB <span>eig</span> function, Python <span>numpy.linalg.eigvals</span>

For specific problems, it is recommended to start with the official documentation and examples of YALMIP or CVXPY, and also refer to the following documents, which are excellent starting points for getting started and solving practical problems.

Solving Linear Matrix Inequalities LMI with MATLAB.pdf

Leave a Comment