Hi! I am new to cvx and am having trouble with the following.

I need to find a matrix X which minimizes the below. When I work with 3x3 matrices the code works fine, but when I try 9x9 matrices I do not get a solution even though I know there is one. Any help would be greatly appreciated

Your problem as entered is unbounded. Perhaps the problem you provided for n = 3 is not unbounded?

You can omit the objective function (minimize command) and get a feasible solution. Alternatively, you can add another constraint, such as norm(X,inf) <= 10, which makes the problem bounded (or perhaps change you input data).

Note that although I don’t think it does any harm, your specification of both X == semidefinite(n) and X >= 0 (under sdp mode, which you have specified) is redundant. Either one by itself would be sufficient (and sdp mode is not needed if you don’t use X >= 0).