# Moving from LMI toolbox (Matlab) to JuliaOpt

**URL:** <https://discourse.julialang.org/t/moving-from-lmi-toolbox-matlab-to-juliaopt/21001>\
**Category:** Optimization (Mathematical)\
**Tags:** optimization, convex-optimization\
**Created:** [February 20, 2019, 6:33am UTC](https://discourse.julialang.org/t/moving-from-lmi-toolbox-matlab-to-juliaopt/21001 "2019-02-20T06:33:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![uwechsler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uwechsler/32/5223_2.png) [@uwechsler](https://discourse.julialang.org/u/uwechsler)\
**Post date:** [May 20, 2019, 3:47pm UTC](https://discourse.julialang.org/t/moving-from-lmi-toolbox-matlab-to-juliaopt/21001/2 "2019-05-20T15:47:17Z")

</div>

Did you have a look at [JuMP](https://github.com/JuliaOpt/JuMP.jl), especially the Section [Semidefinite Constraints](http://www.juliaopt.org/JuMP.jl/stable/constraints/#Semidefinite-constraints-1) or the Example [Example minimal Ellipse](https://github.com/JuliaOpt/JuMP.jl/blob/master/examples/min_ellipse.jl)?  
I have no experience so far in LMI’s but I think this would be a good starting point.

For example solving the Lyapunov Inequality for a continuous system could look like this:

```julia
using JuMP
using MosekTools
using LinearAlgebra

A = [-0.5 1; 0 -0.3]; n = size(A,1); Q = [1 0; 0 1]
model = Model(with_optimizer(Mosek.Optimizer))
@variable(model, P[i=1:n, j=1:n], PSD)
@SDconstraint(model, P ⪰ 0)
@SDconstraint(model, A'*P + P*A ⪯ -Q)
@SDconstraint(model, A'*P + P*A ⪰ -Q)
optimize!(model)
P = value.(P)
# Test result:
A'*P + P*A ≈ -Q

```

---

_[View the full topic](https://discourse.julialang.org/t/moving-from-lmi-toolbox-matlab-to-juliaopt/21001)._
