diff --git a/README.md b/README.md new file mode 100644 index 0000000..fdd9d92 --- /dev/null +++ b/README.md @@ -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. diff --git a/can_recovery.m b/can_recovery.m new file mode 100644 index 0000000..542704f --- /dev/null +++ b/can_recovery.m @@ -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 diff --git a/get_recovery_prob.m b/get_recovery_prob.m new file mode 100644 index 0000000..73b38ce --- /dev/null +++ b/get_recovery_prob.m @@ -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 \ No newline at end of file diff --git a/main.m b/main.m new file mode 100644 index 0000000..e7b8db9 --- /dev/null +++ b/main.m @@ -0,0 +1,11 @@ +N = 100; +M = 100; +T = 50; + +prob = zeros(N, M); +parfor n = 1: N + for s = 1: M + prob(n, s) = get_recovery_prob(n, s, T); + end +end +heatmap(prob) \ No newline at end of file