Add Phase Transitions in FAR using CS folder

This commit is contained in:
Ksyer
2023-12-19 17:12:26 +08:00
parent 4881771558
commit 4a7a8ab31b
18 changed files with 390 additions and 28 deletions
@@ -0,0 +1,36 @@
function flg = Expr2_can_recovery(n, s, d, eps)
theta_real = randn(n, d);
theta_imag = randn(n, d);
theta = theta_real + 1j * theta_imag;
x = zeros(d, 1);
random_indices = randperm(d, s);
x(random_indices) = randn(s, 1);
for i = 1:d
if x(i) ~= 0
t = rand(1);
x(i) = cos(t) + 1j * sin(t);
end
end
y = theta * x;
cvx_begin
variable s1(d)
minimize(norm(s1, 1))
subject to
norm(y - theta * s1) <= eps
cvx_end
p = norm(x - s1, 2);
if p < eps
flg = 1;
else
flg = 0;
end
end