Init
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
This project is used to host the code that reproduces [this academic paper](https://ieeexplore.ieee.org/document/9497742)
|
||||
|
||||
Enviornment:
|
||||
|
||||
- [MATLAB 2023a](https://ww2.mathworks.cn/products.html?s_tid=gn_ps)
|
||||
- [CVX: a Matlab-based convex modeling framework](http://cvxr.com/)
|
||||
- [Parallel Computing Toolbox](https://ww2.mathworks.cn/products/parallel-computing.html)
|
||||
|
||||
Codes:
|
||||
|
||||
- `can_recovery.m`: Determine if the signal can be recovered.
|
||||
- `get_recovery_prob.m`: Obtain the probability that the signal can be recovered under T experiments.
|
||||
- `main.m`: Main function entry.
|
||||
@@ -0,0 +1,25 @@
|
||||
function flg = can_recovery(n, s)
|
||||
d = 100;
|
||||
eps = 1e-5;
|
||||
theta = randn(n, d);
|
||||
y = theta * x;
|
||||
|
||||
x = zeros(d, 1);
|
||||
random_indices = randperm(d, s);
|
||||
x(random_indices) = randn(s, 1);
|
||||
x = sign(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
|
||||
@@ -0,0 +1,7 @@
|
||||
function x = get_recovery_prob(n, s, N)
|
||||
x = 0;
|
||||
for t = 1: N
|
||||
x = x + can_recovery(n, s);
|
||||
end
|
||||
x = x / N;
|
||||
end
|
||||
Reference in New Issue
Block a user