Update Expr3
This commit is contained in:
@@ -1,39 +1,25 @@
|
||||
function flg = Expr3_can_recovery(Phi_far, N, M, n, s, eps)
|
||||
Phi = zeros(n, N * M);
|
||||
indices = randperm(N, n);
|
||||
|
||||
for i = 1:n
|
||||
Phi(i, :) = Phi_far(indices(i), :);
|
||||
end
|
||||
d = M*N;
|
||||
x = zeros(d, 1);
|
||||
random_indices = randperm(d, s);
|
||||
x(random_indices) = randn(s, 1);
|
||||
x = sign(x);
|
||||
% select random n cols
|
||||
col_choose = randperm(N, n);
|
||||
Phi = Phi_far(col_choose, :);
|
||||
|
||||
for i = 1:M * N
|
||||
% generate sparse signal
|
||||
sparse_signal = zeros(M, N);
|
||||
block = randperm(N, s);
|
||||
sparse_signal(:, block) = exp(1i * 2 * pi * rand(M, s));
|
||||
|
||||
if x(i) ~= 0
|
||||
t = rand(1) * 2 * pi;
|
||||
x(i) = cos(t) + 1j * sin(t);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
y = Phi * x;
|
||||
% generate y
|
||||
y = Phi * sparse_signal(:);
|
||||
|
||||
cvx_begin quiet
|
||||
variable s1(d) complex
|
||||
minimize(norm(s1, 1))
|
||||
subject to
|
||||
norm(y - Phi * s1) <= eps
|
||||
variable x(M * N) complex
|
||||
minimize(norm(x, 1))
|
||||
subject to
|
||||
Phi * x == y
|
||||
cvx_end
|
||||
|
||||
x = sign(real(x));
|
||||
s1 = real(s1);
|
||||
|
||||
p = norm(x - s1, 2);
|
||||
disp(p);
|
||||
p = norm(x - sparse_signal(:), 2);
|
||||
|
||||
if p < eps
|
||||
flg = 1;
|
||||
|
||||
Reference in New Issue
Block a user