Add "FAR vs PD"

This commit is contained in:
Ksyer
2024-05-11 15:43:25 +08:00
parent 17386d80c1
commit b48ab07dd0
21 changed files with 412 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
function [indices, z] = get_sparse_vector(N, Amp)
global K extend_target;
z = zeros(N, 1);
if extend_target
target_start_idx = fix(0.4 * N);
target_size = K;
indices = target_start_idx: target_start_idx + target_size;
else
indices = randperm(N, K);
end
z(indices) = Amp;
end