Update Block RIP

This commit is contained in:
Ksyer
2024-02-21 16:44:41 +08:00
parent f357a0c3a7
commit ae199edbcd
16 changed files with 164 additions and 169 deletions
Binary file not shown.
@@ -0,0 +1,25 @@
function flg = can_recovery(Psi, s, eps)
[m, n] = size(Psi);
x = zeros(n, 1);
random_indices = randperm(n, s);
x(random_indices) = randn(s, 1);
x = sign(x);
y = Psi * x;
cvx_begin
variable s1(n)
minimize(norm(s1, 1))
subject to
norm(y - Psi * s1) <= eps
cvx_end
p = norm(x - s1, 2);
if p < eps
flg = 1;
else
flg = 0;
end
end
+11
View File
@@ -0,0 +1,11 @@
function Psi = get_Psi(N, M, epi)
Psi = zeros(N,M*N);
for n = 0 : N-1
Cn = floor(rand()*M);
for q = 0 : N-1
for p = 0:M-1
Psi(n+1,q*M+p+1) = exp(1i*2*pi*p/M*Cn+1i*2*pi*q/N*n*(1+Cn*epi)) / sqrt(N);
end
end
end
end
+34
View File
@@ -0,0 +1,34 @@
clc;
clear;
N = 32;
M = 4;
k = 5;
epi = 0.02;
Psi_wide = get_Psi(N, M, epi);
max_n = 100;
max_s = 100;
trials_time = 50;
d = 5;
eps = 1e-5;
prob = zeros(max_n, max_s);
for n = 1:max_n
Psi_narrow = get_Psi(n, M, 0);
parfor s = 1:max_s
if n > s
x = 0;
for t = 1:trials_time
x = x + can_recovery(Psi_narrow, s, eps);
end
prob(n, s) = x / trials_time;
else
prob(n, s) = 0;
end
end
end
save("Expr1.mat", "prob");