Often it will be useful to accumulate an array of expressions into a single Matlab variable.
Unfortunately, a somewhat technical detail of the Matlab object model can cause problems in such cases.
In CVX we can declare such a variable and impose these constraints using The second line here imposes the constraint that X be positive semidefinite.
(You can read “==” here as “is” or “is in”, so the second line can be read as X is positive semidefinite’.) The lefthand side of the third line is a vector containing the diagonal elements of X, whose elements we require to be equal to one.
multiplication; scalar*array: element-wise multiplication vector*vector: element-wise multiplication (result: scalar) matrix*matrix: matrix product vector*matrix: row-matrix*matrix (result: vector) matrix*vector: matrix*column-matrix (result: vector)division of two scalars or an array by a scalar; division of an array by a scalar is defined element-wise. In order to get integer division with truncation use the function div.
Operator precedence determines the order of evaluation of operators in an expression.This is, of course, equivalent to saying that X must itself be symmetric positive semidefinite.As an example, consider the constraint that a (matrix) variable X is a correlation matrix, i.e., it is symmetric, has unit diagonal elements, and is positive semidefinite.ub can be omitted, in which case it is set equal to lb.For example, , which is the same as performing a minimization with the objective function set to zero.Variables can be real or complex scalars, vectors, matrices, or banded(lb,ub) diagonal hankel hermitian skew_symmetric symmetric toeplitz tridiagonal lower_bidiagonal lower_hessenberg lower_triangular upper_bidiagonal upper_hankel upper_hessenberg upper_triangular the matrix is banded with a lower bandwidth lb and an upper bandwidth ub.If both lb and ub are zero, then a diagonal matrix results.Once an expression holder has been declared, you may freely insert both numeric and CVX expressions into it.For example, the previous example can be corrected as follows: .Sets can be combined in affine expressions, and we can constrain an affine expression to be in a convex set.For example, we can impose a constraint of the form .) The optimal dual variables, each of which is associated with a constraint in the original problem, give valuable information about the original problem, such as the sensitivities with respect to perturbing the constraints ( Of course, the precise interpretation of primal and dual points and/or directions depends on the structure of the problem.