# A basic example for CVX beginners

I would be very thankful if you can provide an example of the code that contains more involved scenarios. An example that the objective and constraints can not be simply defined by elementary commands of MATLAB and one should write expressions for them. I am interested to see how we, (firstly) write such expressions inside the CVX and (secondly) how we integrate it as objective function or constraints?

For example consider the following convex problem.
\begin{align}
\min_{\mathbf{X}{n} \in \mathbb{C}^{N \times N}} & ;; \sum{n=1}^{N} \mathtt{tr} \mathbf{X}{n} \
s.t.& ;; \sum
{n=1}^{N} \mathtt{tr} ( \mathbf{Q}{ni} \mathbf{X}{n} ) \preceq 0 ;;; \forall ; i \in \lbrace1,\ldots,M\rbrace\
& \mathbf{X}{n} \succeq 0 ;;; \forall ; i \in \lbrace1,\ldots,N\rbrace
\end{align}
where \mathbf{X}_{n} \in \mathbb{C}^{N \times N} are hermitian semidefinite matrices representing decison variables and $\mathbf{Q} {ni}$s are fixed (with constant scalar elements) matrices.

1. How do we write the objective function? \
2. How do we write the M + N constraints?

Thank you very much for your help.