I have specified a problem whose objetive function comprises a norm error cost function to be minimized subject to LMI constraints.

minimize norm (error)
subject to LMI ==semidefinite

CVX does solve the problem with an excelent fit to the data but there seems to be some very small negative (something of the magnitude -1e^-7) eigenvalues which violate the constraints.

Is there a way to require cvx not to allow for negative eigenvalues? So to speak could I raise the tolerance to some small but positive eigenvalue, say +1e^-7?

did you use cvx_precision best that would be the first thing to try. Also showing us the LMI might help. If it is badly conditioned in the sense of not have any strictly feasible points then you will have difficulty finding a good solution with guaranteed nonnegativity.

Also you can try sdpt3 rather than sedumi. sedumi is the default I think for cvx? But sedumi allows for small negative eigenvalues for the dual slacks in the primal-dual embedding.

I’m puzzled by solutions I’m getting with Mosek. @Erling.

Given a state-space realization (A,B,Co,Do) (problem data) which is controllable but does not satisfy the Kalman-Yakubovich-Popov Lemma (Positive-Real Lemma), my problem consists of computing perturbations to the elements of matrices (C,D) so that the KYP is satisfied while minimizing the perturbation size. That is to say I want the nearest model that satisfies the KYP LMI constraints.
I measure proximity by norm which and the constraints are the KYP constraints explicitly written:

`
minimize norm(Hx)

subject to [-A'*P-P*A, -P*B+Co+\deltaC(x); -B'*P+(Co+\deltaC(x) )', (D+\deltaD)+(D+\deltaD)'] ==
semidefinite
P == semidefinite

`
I perturb only parameter matrices Co and Do while keeping A and B fixed, A is obviously stable.
Mosek does find a solution which satisfies the Lyapunov inequality with a positive definite auxiliar Lyapunov variable but the LMI constraint is violated.
Mosek signals the problem as unbounded (perhaps because the unfeasible start) and the solver stalls with both primal and dual almost identical in value.
I had initially thought relaxing the semidefinite constraints but violations are large in mgnitude, ie the KYP LMI is indefinite and I cannot force it to be definite by computiong perturbations to it.

By the way, I pinned @Erling because when I switch from Mosek to SDPt3 The solver presents a solution even though the duality gap is not zero as well. I tend to believe Mosek to be the best. There is something fishy in my problem.

If I should say something meaningful about a concrete problem then showing the complete log is always a good idea.

Based on the information you provide your problem is illposed though. An arbitrary example of an illposed problem you obtain by minimize 1/x st. x>=0. The optimal value is 0 but is never attained.

However, when I had a course on convex optimization by Ken Kortanek he would show there was a tons of ways for a problem to be illposed.

Despite the difficult solution process, mosek has spitted out a numeric solution instead of Nans or Infs, the the solution violates the positivity constraints.

I sometimes run this same formulation but call SDPT3 instead, I get a worse approximation but constraints are not violated. I got me puzzled.

does not converge towards -1 or +1. That usually means your problem is illposed.

A newer version of MOSEK than you are using might be doing better. However, I suspect you will have to improve your model if you want to use the results you get.

By newer version you mean the Beta 9.0.81?
Because the version I have is the one downloaded from link
8.1.0.80, even though the log strangely refers to a much older 8.0.0.60) maybe there is something wrong with the link at Mosek websit. But I get version 8.0.0.60 even when I download 8.1.0.80.

MOSEK 8.0.0.60 is provided in the CVX distribution, and is the version chosen for use by CVX if cvx_solver mosek is specified. You can either get rid of or rename the mosek directory under CVX so that CVX doesn’t find it. Or see what the version you want is called in the output of cvx_solver and specify that with cvx_solver.

How do I specify the other/newer version to CVX ? Is there a way to set the path in CVX? I set the matlab path but it failed to find the solver.
Actually, the question is how to set the location for the solver when I want cvx to use other version than the one provided in the CVX distribution.

If you give the command cvx_solver
you should see a list of all the Mosek versions CVX has access to. For instance,if 8.1.0.80 is Mosek_2 . then give the command cvx_solver Mosek_2