# If the corresponding code is correct (SOC)?

Hello,everyone!
I used CVX to solve a convex optimization problem and got an result of “Failed”. One of the constraints which is further rewritten as the SOC form(see the picture).
I want to know if the corresponding code is correct?.

constraint :

code :

%parameter
pai1_f=sla_v_ini.pai1; %(E,N)
pai2_f=sla_v_ini.pai2; %(E,N)
ga3=gamaPJ;

cvx_begin
cvx_quiet true
cvx_solver sdpt3;
variable s
variable pai1(E,N)
variable pai2(E,N) nonnegative
expression F_45(E,N) %(45)

for e=1:E %(F45)
for n=1:N
F_45(e,n)=(pai1_f(e,n)-pai2_f(e,n))
(pai1(e,n)-pai2(e,n))/4+ga3/2 -((pai1_f(e,n)-pai2_f(e,n))^2)/8-1/2;
end
end

maximize s;

subject to
for e=1:E %(45)
for n=1:N
norm([(pai1(e,n)+pai2(e,n))/2 F_45(e,n)])<=F_45(e,n)+1;%(45)
end
end

cvx_end

If you write them carefully, they will be correct. For SOC definition, check https://docs.mosek.com/modeling-cookbook/cqo.html

Please remove `cvx_quiet true`, and show all solver and CVX output.

Also, try a different solver, such as sedumi, and if available to you, mosek or gurobi.

One of the most common reasons for solver failure is “bad” input data, such as from poor scaling, with some input data many orders of magnitude from one.

The output is shown as below after removing `cvx_quiet true`: