Delete useless code
This commit is contained in:
@@ -1,77 +0,0 @@
|
|||||||
% Input:y,A,lambda,tau,Kit
|
|
||||||
% Output:x_hat_wl,x_hat_d
|
|
||||||
|
|
||||||
function [x_hat_wl, x_hat_d] = cVAMP(y, A, lambda, tau, Kit)
|
|
||||||
% Initialization
|
|
||||||
gamma = 768 ./ 1024;
|
|
||||||
k = 0;
|
|
||||||
p = ctranspose(A) * y;
|
|
||||||
h_1 = p;
|
|
||||||
Q_1 = gamma;
|
|
||||||
tau_d = 1;
|
|
||||||
|
|
||||||
% while
|
|
||||||
while (k < Kit) && (tau_d > tau)
|
|
||||||
% Factorized Part
|
|
||||||
x_1 = ST(h_1, lambda, Q_1); % \hat{x}_1^{(k)}
|
|
||||||
chi_1 = F1(x_1, lambda, Q_1); % \chi_1^{(k)}
|
|
||||||
% Message Passing
|
|
||||||
h_2 = x_1 ./ chi_1 - h_1; % h_2^{(k)}
|
|
||||||
Q_2 = 1 ./ chi_1 - Q_1; % \hat{Q}_2^{(k)}
|
|
||||||
% Gaussian Part
|
|
||||||
t1 = (p + h_2) ./ Q_2;
|
|
||||||
t2 = ctranspose(A) * (A * (p + h_2)) / ((Q_2 + 1) * Q_2);
|
|
||||||
x_2 = t1 + t2; % \hat{x}_2^{(k)}
|
|
||||||
chi_2 = gamma ./ (Q_2 + 1) + (1 - gamma) ./ Q_2;
|
|
||||||
% Message Passing
|
|
||||||
h_1_next = x_2 ./ chi_2 - h_2;
|
|
||||||
Q_1_next = 1 ./ chi_2 - Q_2;
|
|
||||||
tau_d = norm(h_1_next - h_1) ./ norm(h_1_next);
|
|
||||||
k = k + 1;
|
|
||||||
% output
|
|
||||||
x_hat_wl = x_1;
|
|
||||||
x_hat_d = h_1_next ./ Q_1_next;
|
|
||||||
% next
|
|
||||||
h_1 = h_1_next;
|
|
||||||
Q_1 = Q_1_next;
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
% SoftThreshold function
|
|
||||||
function x = ST(h_1, lambda, Q_1)
|
|
||||||
[N, M] = size(h_1);
|
|
||||||
x = zeros(N, M);
|
|
||||||
|
|
||||||
for i = 1:N
|
|
||||||
% sign = h_1(i) ./ abs(h_1(i));
|
|
||||||
diff = abs(h_1(i)) - lambda(i);
|
|
||||||
x(i) = sign(h_1(i)) .* (diff ./ Q_1) .* SF(diff);
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
% Heaviside's step function
|
|
||||||
function v = SF(a)
|
|
||||||
% if a > 0
|
|
||||||
% v = 1;
|
|
||||||
% elseif a == 0
|
|
||||||
% v = 0; % at zero points
|
|
||||||
% else
|
|
||||||
% v = 0;
|
|
||||||
% end
|
|
||||||
v = heaviside(a);
|
|
||||||
end
|
|
||||||
|
|
||||||
% SoftThreshold function
|
|
||||||
function v = F1(x_1, lambda, Q_1)
|
|
||||||
[N, M] = size(x_1);
|
|
||||||
count = 0;
|
|
||||||
|
|
||||||
for i = 1:N
|
|
||||||
temp = Q_1 .* abs(x_1(i)) + lambda(i);
|
|
||||||
count = count + (2 - lambda(i) ./ temp) .* SF(abs(x_1(i)));
|
|
||||||
end
|
|
||||||
|
|
||||||
v = count ./ (2 .* N .* Q_1);
|
|
||||||
end
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
% Input:y,A,lambda,tau,Kit
|
|
||||||
% Output:x_hat_wl,x_hat_d
|
|
||||||
clear;
|
|
||||||
clc;
|
|
||||||
% rng(1); % 随机种子
|
|
||||||
|
|
||||||
%% test_稀疏向量
|
|
||||||
% 设定稀疏度
|
|
||||||
k = 100; % 设定稀疏度
|
|
||||||
|
|
||||||
% 构造感知矩阵D
|
|
||||||
m = 768; % 感知矩阵行数
|
|
||||||
n = 1024; % 感知矩阵列数 (n>>m)
|
|
||||||
|
|
||||||
% D = randn(m,n); % 生成满足高斯分布的感知矩阵 64*256
|
|
||||||
|
|
||||||
F = dftmtx(n);
|
|
||||||
row_indices = randperm(n, m);
|
|
||||||
D = F(row_indices, :);
|
|
||||||
|
|
||||||
% 构造稀疏信号X——共n个元素,其中k个元素不为0
|
|
||||||
X = zeros(n, 1);
|
|
||||||
index = randperm(n, k);
|
|
||||||
val = randn(1, k);
|
|
||||||
X(index) = val;
|
|
||||||
|
|
||||||
% 得到观测矩阵(压缩后)
|
|
||||||
A = D * X;
|
|
||||||
|
|
||||||
%%
|
|
||||||
% % 通过cVMAP算法完成恢复X,得到恢复后信号
|
|
||||||
lambda = ones(n, 1) ./ 10;
|
|
||||||
[x_hat_wl, x_hat_d] = cVAMP(A, D, lambda, 1e-4, 200);
|
|
||||||
|
|
||||||
%%
|
|
||||||
% 显示结果
|
|
||||||
figure;
|
|
||||||
subplot(3, 1, 1)
|
|
||||||
stem(X);
|
|
||||||
title('origin signal')
|
|
||||||
subplot(3, 1, 2)
|
|
||||||
stem(x_hat_wl);
|
|
||||||
title('restored signal')
|
|
||||||
subplot(3, 1, 3)
|
|
||||||
stem(X - x_hat_wl);
|
|
||||||
title('differ')
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
clc; clear; close all;
|
|
||||||
|
|
||||||
parameters;
|
|
||||||
|
|
||||||
global trail_times;
|
|
||||||
|
|
||||||
[s_T_narrow, A] = narrow_signal_model(t, 1);
|
|
||||||
|
|
||||||
A = A / 10;
|
|
||||||
|
|
||||||
AH = A';
|
|
||||||
|
|
||||||
H0 = [];
|
|
||||||
for T = 1: trail_times
|
|
||||||
x = zeros(10, 1);
|
|
||||||
% x(4) = 0.8;
|
|
||||||
y = A * x;
|
|
||||||
y_noise = awgn(y, 15);
|
|
||||||
|
|
||||||
x_hat = AH * y_noise;
|
|
||||||
|
|
||||||
H0 = [H0 x_hat'];
|
|
||||||
end
|
|
||||||
|
|
||||||
H1 = [];
|
|
||||||
for T = 1: trail_times
|
|
||||||
x = zeros(10, 1);
|
|
||||||
x(4) = 0.8;
|
|
||||||
y = A * x;
|
|
||||||
y_noise = awgn(y, 15);
|
|
||||||
|
|
||||||
x_hat = AH * y_noise;
|
|
||||||
|
|
||||||
H1 = [H1 x_hat(4)];
|
|
||||||
end
|
|
||||||
|
|
||||||
% figure; histfit(real(H0));
|
|
||||||
% figure; histfit(real(H1));
|
|
||||||
|
|
||||||
figure;
|
|
||||||
plot()
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
function [s_T_narrow, A_narrow] = narrow_signal_model(t, betas_narrow)
|
|
||||||
global f_c N_narrow N FIGURE N_wide numP f_s K_chirp T_r;
|
|
||||||
|
|
||||||
tt = 0: 1/f_s: numP * T_r - 1/f_s;
|
|
||||||
|
|
||||||
% 使用等效散射系数生成窄带情况信号模型
|
|
||||||
s_T_narrow = zeros(1, N * numP);
|
|
||||||
for j = 1: numP
|
|
||||||
idx = ((j-1) * N + (1:N_narrow));
|
|
||||||
tp = idx / f_s;
|
|
||||||
s_T_narrow(1, idx) = exp(1j * 2 * pi * (f_c * tp + 0.5 * K_chirp * tp .^ 2));
|
|
||||||
end
|
|
||||||
|
|
||||||
% s_T_narrow = exp(1j .* 2 .* pi .* f_c .* t);
|
|
||||||
s_R_narrows = zeros(N_narrow, N * numP);
|
|
||||||
for i = 1: N_narrow
|
|
||||||
p = i * (N_wide / N_narrow);
|
|
||||||
s_R_narrows(i, :) = betas_narrow * [zeros(1, p), s_T_narrow(1: end-p)];
|
|
||||||
end
|
|
||||||
|
|
||||||
A_narrow = s_R_narrows';
|
|
||||||
if FIGURE
|
|
||||||
subplot(2, 1, 1); plot(tt, real(s_T_narrow));
|
|
||||||
subplot(2, 1, 2); plot(tt, real(s_R_narrows(1, :)));
|
|
||||||
end
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
global bandwidth T_p f_s T_s K_chirp f_c PRF T_r numP t tP c N M R_0...
|
|
||||||
delta_R_wide delta_R_narrow N_wide N_narrow ranges_wide...
|
|
||||||
ranges_narrow betas_wide FIGURE K_wide K_narrow trail_times...
|
|
||||||
method N_high TEST lambda tau iter_max noise_sigma FAR_N FAR_M noise_sigma_2 DEBUG_LEVEL...
|
|
||||||
;
|
|
||||||
|
|
||||||
f_c = 10e9; % X wave
|
|
||||||
bandwidth = 100e6;
|
|
||||||
T_p = 1e-5;
|
|
||||||
f_s = 2 * bandwidth;
|
|
||||||
T_s = 1 / f_s;
|
|
||||||
K_chirp = bandwidth / T_p;
|
|
||||||
T_r = T_p * 10;
|
|
||||||
PRF = 1 / T_r;
|
|
||||||
|
|
||||||
numP = 10;
|
|
||||||
|
|
||||||
t = 0: 1 / f_s: T_r - 1 / f_s;
|
|
||||||
tP = 0: 1 / f_s: T_r * numP - 1 / f_s;
|
|
||||||
|
|
||||||
c = 3e8; % 光速
|
|
||||||
|
|
||||||
N = length(t);
|
|
||||||
N_high = T_p * f_s;
|
|
||||||
M = round(T_p * bandwidth);
|
|
||||||
R_0 = 0;
|
|
||||||
delta_R_wide = c ./ 2 ./ bandwidth;
|
|
||||||
delta_R_narrow = T_p .* c ./ 2;
|
|
||||||
N_wide = 100;
|
|
||||||
N_narrow = round(N_wide / M);
|
|
||||||
|
|
||||||
% alert(N > N_narrow);
|
|
||||||
|
|
||||||
ranges_wide = R_0 + (0:N_wide) * delta_R_wide; % [1000, 4000]
|
|
||||||
ranges_narrow = R_0 + (0:N_narrow) * delta_R_narrow; % [1000, 4000]
|
|
||||||
betas_wide = linspace(1, 0.1, N_wide) + 1j * linspace(0.1, 1, N_wide);
|
|
||||||
|
|
||||||
K_wide = round(N_wide / 10);
|
|
||||||
K_narrow = round(K_wide / 10);
|
|
||||||
|
|
||||||
FIGURE = false;
|
|
||||||
trail_times = 5000;
|
|
||||||
% method = "debiased_LASSO";
|
|
||||||
% method = "LASSO";
|
|
||||||
% method = "BP";
|
|
||||||
method = "cVAMPro";
|
|
||||||
TEST = false;
|
|
||||||
|
|
||||||
lambda = 0.01;
|
|
||||||
tau = 1e-6;
|
|
||||||
iter_max = 1000;
|
|
||||||
|
|
||||||
noise_sigma = 0.1;
|
|
||||||
noise_sigma_2 = 0.1;
|
|
||||||
|
|
||||||
FAR_N = 480;
|
|
||||||
FAR_M = 10;
|
|
||||||
|
|
||||||
DEBUG_LEVEL = 1;
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
N = 32e9;
|
|
||||||
M = 3;
|
|
||||||
eps = 1e-4;
|
|
||||||
|
|
||||||
delta_1 = 24 * sqrt((M-1)/N) * log(M*N) * (2*sqrt(log(M * N) - log(eps)) + 1);
|
|
||||||
delta_2 = 3/2 * sqrt((M-1)/N) * (2*sqrt(log(M * 2) - log(eps)) + 1);
|
|
||||||
|
|
||||||
K = N * (1/8 - delta_1 - delta_2)^2 / (81 * M * log(M * N) * (1 + 2/3 * delta_2));
|
|
||||||
|
|
||||||
x = 0:25;
|
|
||||||
Ns = N * (1+randn(size(x)));
|
|
||||||
delta_1 = 24 * sqrt((M-1)./N) * log(M.*N) * (2*sqrt(log(M .* N) - log(eps)) + 1);
|
|
||||||
delta_2 = 3/2 * sqrt((M-1)./N) * (2*sqrt(log(M * 2) - log(eps)) + 1);
|
|
||||||
Ks = Ns * (1/8 - delta_1 - delta_2)^2 / (81 * M * log(M .* Ns) * (1 + 2/3 * delta_2));
|
|
||||||
|
|
||||||
rate = K .* M .* log(M .* Ns) ./ Ns;
|
|
||||||
plot(x, rate)
|
|
||||||
Reference in New Issue
Block a user