Why the optimization result of R is NaN?

When I run the following code, I can’t get the optimization result. I don’t understand why?
%code
function [R] = rankrecover(s,Mat,M)
I = eye(MM);
for i = 1:M
for j = 1:M-i+1
idx((2
M-i+2)(i-1)/2+j) = (i-1)M+1+(M+1)(j-1);
end
end
Q = I(idx,:);
% cvx_solver sdpt3
cvx_begin quiet
cvx_precision low
variable R(M,M) complex semidefinite hermitian toeplitz
expressions r(M
M,1)
r = R(:);
expressions q(M*(M+1)/2,1)
q = Q*r;

minimize norm_nuc( R )
subject to
norm(s-Mat*q,‘fro’) <= 1e-1;
cvx_end

Do not use quiet, do not use cvx_precision, share the log output.

Calling SDPT3 4.0: 156 variables, 61 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 61
dim. of sdp var = 30, num. of sdp blk = 2
dim. of socp var = 29, num. of socp blk = 1
dim. of linear var = 2


SDPT3: Infeasible path-following algorithms


version predcorr gam expon scale_data
HKM 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime

0|0.000|0.000|5.6e+01|1.4e+00|8.1e+03| 1.077033e+00 0.000000e+00| 0:0:00| chol 1 1
1|0.706|0.663|1.6e+01|4.9e-01|2.4e+03|-8.320927e+02 -9.355397e+01| 0:0:01| chol 1 1
2|0.205|0.106|1.3e+01|4.4e-01|2.4e+03|-5.485681e+03 -1.007329e+02| 0:0:01| chol 1 1
3|0.190|0.116|1.1e+01|3.9e-01|2.8e+03|-5.681019e+04 -1.143737e+02| 0:0:01| chol 1 1
4|0.001|0.003|1.1e+01|3.8e-01|4.5e+03|-1.817997e+05 -1.133559e+02| 0:0:01| chol 1 1
5|0.011|0.002|1.0e+01|3.8e-01|1.3e+05|-6.763112e+06 -1.166884e+02| 0:0:01| chol 1 1
6|0.002|0.001|1.0e+01|3.8e-01|1.4e+06|-1.038518e+08 -1.153493e+02| 0:0:01| chol 1 1
7|0.022|0.006|1.0e+01|3.8e-01|9.7e+07|-1.386261e+10 -1.766083e+02| 0:0:01| chol 1 1
8|0.000|0.001|1.0e+01|3.8e-01|6.2e+08|-9.980478e+10 -1.186648e+03| 0:0:01| chol 2 2
9|0.000|0.000|1.0e+01|3.8e-01|7.8e+09|-1.354310e+12 -3.298404e+03| 0:0:01| chol 2 2
10|0.000|0.000|1.0e+01|3.8e-01|2.2e+10|-3.990911e+12 -2.992839e+04| 0:0:01| chol 2 2
11|0.000|0.000|1.0e+01|3.8e-01|2.1e+11|-3.941574e+13 -6.039817e+04| 0:0:01| chol 2 2
12|0.000|0.000|1.0e+01|3.8e-01|5.1e+11|-9.762832e+13 -5.603622e+05| 0:0:01| chol 2 2
13|0.000|0.000|1.0e+01|3.8e-01|4.2e+12|-8.187419e+14 -1.173300e+06| 0:0:01| chol 2 2
14|0.000|0.000|1.0e+01|3.8e-01|1.1e+13|-2.220752e+15 -9.948779e+06| 0:0:01| chol 2 2
15|0.000|0.000|1.3e+01|3.8e-01|8.4e+13|-1.745329e+16 -2.259315e+07| 0:0:01| chol 2 2
16|0.000|0.000|4.8e+01|3.8e-01|2.3e+14|-4.970572e+16 -1.692041e+08| 0:0:01| chol 2 2
stop: primal infeas has deteriorated too much, 1.4e+03
17|0.000|0.000|4.8e+01|3.8e-01|2.3e+14|-4.970572e+16 -1.692041e+08| 0:0:01|
prim_inf,dual_inf,relgap = 4.76e+01, 3.80e-01, 4.69e-03
sqlp stop: dual problem is suspected of being infeasible

number of iterations = 17
residual of dual infeasibility
certificate X = 9.75e-13
reldist to infeas. <= 1.44e-12
Total CPU time (secs) = 0.85
CPU time per iteration = 0.05
termination code = 2
DIMACS: 1.0e+01 0.0e+00 9.0e-01 0.0e+00 -1.0e+00 5.2e-03


Status: Infeasible
Optimal value (cvx_optval): +Inf

CVX reported that the problem is infeasible. All but section 1 of https://yalmip.github.io/debugginginfeasible also applies to CVX.

I try to use YALMIP to solve the problem, but it does not work.Why?

%code
R = sdpvar(M,M,‘full’,‘complex’);
r = sdpvar(MM,1,‘full’,‘complex’);
q = sdpvar(M
(M+1)/2,1,‘full’,‘complex’);
c = [];
c = [c,R >= 0,r == R(:),R == R’,q == Qr,norm(s-Matq) <= 0.1];
f = norm(R,‘nuclear’);
result = optimize(c,f);
if result.problem == 0
R = value®;
else
disp(‘wrong’);
end

num. of constraints = 182
dim. of sdp var = 20, num. of sdp blk = 1
dim. of socp var = 29, num. of socp blk = 1
dim. of linear var = 52
dim. of free var = 130
*** convert ublk to linear blk


SDPT3: homogeneous self-dual path-following algorithms


version predcorr gam expon
HKM 1 0.000 1
it pstep dstep pinfeas dinfeas gap mean(obj) cputime kap tau theta

0|0.000|0.000|1.2e+02|4.0e+00|1.5e+04| 5.000000e-01| 0:0:00|1.5e+04|1.0e+00|1.0e+00| chol 1 1
1|0.109|0.109|1.1e+02|4.0e+00|1.6e+04|-2.408793e+00| 0:0:00|1.5e+04|1.0e+00|9.7e-01| chol 1 1
2|0.338|0.338|9.7e+01|3.8e+00|1.6e+04|-4.191018e+01| 0:0:00|1.3e+04|1.0e+00|8.3e-01| chol 1 1
3|0.689|0.689|1.0e+02|3.7e+00|3.4e+04|-3.177355e+02| 0:0:00|9.7e+03|5.9e-01|5.1e-01| chol 1 1
4|0.988|0.988|4.7e+01|1.6e+00|2.6e+04|-1.212578e+03| 0:0:00|4.0e+03|3.5e-01|1.4e-01| chol 1 1
5|0.990|0.990|5.4e+01|1.9e+00|7.1e+04|-9.215953e+02| 0:0:00|2.1e+03|1.8e-01|8.4e-02| chol 1 1
6|0.928|0.928|5.8e+01|2.0e+00|1.7e+05|-1.369662e+03| 0:0:00|1.3e+03|8.5e-02|4.2e-02| chol 1 1
7|0.995|0.995|2.2e+01|7.5e-01|1.6e+05|-7.593987e+03| 0:0:00|8.2e+02|3.3e-02|6.3e-03| chol 1 1
8|1.000|1.000|3.5e+01|1.2e+00|2.7e+06|-1.077486e+05| 0:0:00|7.6e+02|3.1e-03|9.4e-04| chol 1 1
9|0.970|0.970|2.3e+01|7.7e-01|2.9e+07|-2.054306e+06| 0:0:00|7.7e+02|1.8e-04|3.5e-05| chol 1 1
10|0.973|0.973|1.9e+01|6.4e-01|6.3e+08|-5.900605e+07| 0:0:00|7.7e+02|6.7e-06|1.1e-06|
Stop: dual problem is suspected of being infeasible

number of iterations = 10
residual of dual infeasibility
certificate X = 3.28e-07
reldist to infeas. <= 1.12e-09
Total CPU time (secs) = 0.15
CPU time per iteration = 0.01
termination code = 2
DIMACS: 1.9e+01 0.0e+00 6.4e-01 0.0e+00 -9.6e-01 5.3e+00

wrong

Follow the advice in the link,whether you use CVX or YALMIP.