在这篇文章中中,我将给出如何实现稀疏信号恢复的ADMM方法的细节。具体代码如下:
clear; close all; clc;
rng(0); % for reproducibility, do not change it!
m = 50; % num samples
n = 200; % num variables, note that n > m
A = rand(m, n); % simulate matrix A 模拟矩阵A
x = zeros(n, 1); % simulate true sparse signal x: line 13-16 模拟稀疏信号
nz = 10; %
nz_idx = randperm(n);
x(nz_idx(1:nz)) = 2 * rand(nz, 1);
y = A*x; % simulate a degraded signal
y = y + 0.1 * rand(m, 1); % add some noise to the degraded signal
[m, n] = size(A);
b = zeros(n,1); %n行1列
b1 = zeros(m,1);
b2 = zeros(n,1);
beta1 = 1e-1; % The para. in Algrithm 1
beta2 = 1e-2;
lambda = 1e-2;
k=0;
ReErr=1;
maxitr = 500;
tol = 1e-8;
b_old = b;
b1_old = b1;
b2_old = b2;
while ReErr> tol && k<maxitr
u_old = sign(y-A*b_old-b1_old).*max(abs(y-A*b_old-b1_old)-1/beta1,0) ;%第一次计算u
v_old = sign(b_old-b2_o