Add lyh-非满秩相变
This commit is contained in:
@@ -0,0 +1,229 @@
|
||||
close all;
|
||||
clear all;
|
||||
clc;
|
||||
M = 4;
|
||||
N = 128;
|
||||
%block_sparsity = 1;
|
||||
tol = 1e-5;
|
||||
trial = 50;
|
||||
epi = 0.02;
|
||||
result = zeros(N,25);
|
||||
for col = 4:4:128
|
||||
for block_sparsity = 10:18
|
||||
success_count = 0;
|
||||
for loop = 1:trial
|
||||
FAR_model = zeros(N,M*N);
|
||||
%Cn = randperm(M)-1
|
||||
for n = 0 : N-1
|
||||
Cn = floor(rand()*M);
|
||||
for q = 0 : N-1
|
||||
for p = 0:M-1
|
||||
FAR_model(n+1,q*M+p+1) = exp(1i*2*pi*p/M*Cn+1i*2*pi*q/N*n*(1+Cn*epi));
|
||||
end
|
||||
end
|
||||
end
|
||||
col_choose = randperm(N,col);
|
||||
FAR_model = FAR_model(col_choose,:);
|
||||
sparse_signal = zeros(M,N);
|
||||
block = randperm(N,block_sparsity);
|
||||
sparse_signal(:,block) = exp(1i*2*pi*rand(M,block_sparsity));
|
||||
y = FAR_model * sparse_signal(:);
|
||||
cvx_begin
|
||||
variable x(M,N) complex
|
||||
norm21 = 0;
|
||||
for i = 1:N
|
||||
norm21 = norm21 + norm(x(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
FAR_model * x(:) == y
|
||||
cvx_end
|
||||
if norm(x(:)-sparse_signal(:))<tol
|
||||
success_count = success_count+1;
|
||||
end
|
||||
end
|
||||
result(col,block_sparsity) = success_count/trial;
|
||||
end
|
||||
end
|
||||
%save('FARblockepsilon2.mat');
|
||||
|
||||
%%
|
||||
close all;
|
||||
clear all;
|
||||
clc;
|
||||
M = 4;
|
||||
N = 128;
|
||||
%block_sparsity = 1;
|
||||
tol = 1e-5;
|
||||
trial = 30;
|
||||
epi = 0.02;
|
||||
result = zeros(1,25);
|
||||
col = 128;
|
||||
Prob = [1/3,1/3,1/6,1/6];
|
||||
for block_sparsity = 4:18
|
||||
success_count = 0;
|
||||
for loop = 1:trial
|
||||
FAR_model = zeros(N,M*N);
|
||||
%Cn = randperm(M)-1
|
||||
for n = 0 : N-1
|
||||
Cn = randsrc(1,1,[[0,1,2,3];Prob]);
|
||||
for q = 0 : N-1
|
||||
for p = 0:M-1
|
||||
FAR_model(n+1,q*M+p+1) = exp(1i*2*pi*p/M*Cn+1i*2*pi*q/N*n*(1+Cn*epi));
|
||||
end
|
||||
end
|
||||
end
|
||||
%col_choose = randperm(N,col);
|
||||
%FAR_model = FAR_model(col_choose,:);
|
||||
sparse_signal = zeros(M,N);
|
||||
block = randperm(N,block_sparsity);
|
||||
sparse_signal(:,block) = exp(1i*2*pi*rand(M,block_sparsity));
|
||||
y = FAR_model * sparse_signal(:);
|
||||
cvx_begin
|
||||
variable x(M,N) complex
|
||||
norm21 = 0;
|
||||
for i = 1:N
|
||||
norm21 = norm21 + norm(x(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
FAR_model * x(:) == y
|
||||
cvx_end
|
||||
if norm(x(:)-sparse_signal(:))<tol
|
||||
success_count = success_count+1;
|
||||
end
|
||||
end
|
||||
result(block_sparsity) = success_count/trial;
|
||||
end
|
||||
%%
|
||||
clc;
|
||||
M = 4;
|
||||
N = 128;
|
||||
%block_sparsity = 1;
|
||||
tol = 1e-5;
|
||||
trial = 30;
|
||||
epi = 0.02;
|
||||
result2 = zeros(2,25);
|
||||
col = 128;
|
||||
Prob = [1/3,1/3,1/6,1/6];
|
||||
for block_sparsity = 4:18
|
||||
success_count = 0;
|
||||
success_count2 = 0;
|
||||
for loop = 1:trial
|
||||
FAR_model = zeros(N,M*N);
|
||||
%Cn = randperm(M)-1
|
||||
for n = 0 : N-1
|
||||
Cn = randsrc(1,1,[[0,1,2,3];Prob]);
|
||||
for q = 0 : N-1
|
||||
for p = 0:M-1
|
||||
FAR_model(n+1,q*M+p+1) = exp(1i*2*pi*p/M*Cn+1i*2*pi*q/N*n*(1+Cn*epi));
|
||||
end
|
||||
end
|
||||
end
|
||||
%col_choose = randperm(N,col);
|
||||
%FAR_model = FAR_model(col_choose,:);
|
||||
sparse_signal = zeros(M,N);
|
||||
block = randperm(N,block_sparsity);
|
||||
sparse_signal(:,block) = exp(1i*2*pi*rand(M,block_sparsity));
|
||||
y = FAR_model * sparse_signal(:);
|
||||
cvx_begin
|
||||
variable x(M,N) complex
|
||||
norm21 = 0;
|
||||
for i = 1:N
|
||||
norm21 = norm21 + norm(FAR_model(:,M*i-3:M*i)*x(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
FAR_model * x(:) == y
|
||||
cvx_end
|
||||
err1 = 0;
|
||||
for i =1:N
|
||||
err1 = err1 + norm(FAR_model(:,M*i-3:M*i)*(x(:,i)-sparse_signal(:,i)));
|
||||
end
|
||||
if err1<tol
|
||||
success_count2 = success_count2 +1;
|
||||
end
|
||||
if norm(x(:)-sparse_signal(:))<tol
|
||||
success_count = success_count+1;
|
||||
end
|
||||
end
|
||||
result2(1,block_sparsity) = success_count/trial;
|
||||
result2(2,block_sparsity) = success_count2/trial;
|
||||
end
|
||||
|
||||
|
||||
%%
|
||||
|
||||
|
||||
close all;
|
||||
clear all;
|
||||
clc;
|
||||
M = 4;
|
||||
N = 64;
|
||||
%block_sparsity = 1;
|
||||
tol = 1e-5;
|
||||
trial = 50;
|
||||
epi = 0.02;
|
||||
%result = zeros(N,25);
|
||||
%for col = 4:4:128
|
||||
col = 64;
|
||||
block_sparsity = 6;
|
||||
err = 0.1;
|
||||
sigma = 0.5*sqrt(block_sparsity);
|
||||
|
||||
|
||||
|
||||
FAR_model = zeros(N,M*N);
|
||||
%Cn = randperm(M)-1
|
||||
for n = 0 : N-1
|
||||
Cn = floor(rand()*M);
|
||||
for q = 0 : N-1
|
||||
for p = 0:M-1
|
||||
FAR_model(n+1,q*M+p+1) = exp(1i*2*pi*p/M*Cn-1i*2*pi*q/N*n*(1+Cn*epi));
|
||||
end
|
||||
end
|
||||
end
|
||||
%col_choose = randperm(N,col);
|
||||
%FAR_model = FAR_model(col_choose,:);
|
||||
sparse_signal = zeros(M,N);
|
||||
block = randperm(N,block_sparsity);
|
||||
sparse_signal(:,block) = exp(1i*2*pi*rand(M,block_sparsity));
|
||||
y = FAR_model * sparse_signal(:) + sigma*(randn(N,1)) + 1i*sigma*(randn(N,1));
|
||||
cvx_begin
|
||||
variable x(M,N) complex
|
||||
norm21 = 0;
|
||||
for i = 1:N
|
||||
norm21 = norm21 + norm(x(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
norm(FAR_model * x(:) - y)<err
|
||||
cvx_end
|
||||
|
||||
|
||||
x_block_norm = zeros(N,1);
|
||||
x_norm = zeros(N,1);
|
||||
for i = [1:N]
|
||||
x_block_norm(i) = norm(FAR_model(:,M*i-3:M*i)*x(:,i));
|
||||
x_norm(i) = norm(FAR_model(:,M*i-3:M*i)*sparse_signal(:,i));
|
||||
end
|
||||
|
||||
hold on
|
||||
plot(x_block_norm,'--o');
|
||||
plot(x_norm,'-.s');
|
||||
lgh = legend("Estimated","Ground Truth", ...
|
||||
"MF");
|
||||
set(lgh,'interpreter','latex','FontName','Times New Roman')
|
||||
%set(gcf,'interpreter','latex','FontName','Times New Roman')
|
||||
xlabel("\fontname{Times New Roman}Velocity Cell Index");
|
||||
ylabel("\fontname{Times New Roman}Test Statistics \it{T_i}");
|
||||
xlim([0 75]);
|
||||
|
||||
|
||||
|
||||
|
||||
%end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
N = 32;
|
||||
M =4;
|
||||
R =2;
|
||||
epi = 0.02;
|
||||
noise = [0.1,0.1^(0.5)];
|
||||
%contri1 = zeros(M,N);
|
||||
%contri2 = zeros(M,N);
|
||||
con1 = zeros(20,2);
|
||||
con2 = zeros(20,2);
|
||||
re1 = zeros(20,2);
|
||||
re2 = zeros(20,2);
|
||||
|
||||
for noise_k = 1:2
|
||||
for k = 1:20
|
||||
for loop = 1:50
|
||||
|
||||
|
||||
FAR_model = zeros(N,M*N);
|
||||
order = randperm(M)-1;
|
||||
for n = 0 : N-1
|
||||
Cn = order(ceil(rand()*R));
|
||||
for q = 0 : N-1
|
||||
for p = 0:M-1
|
||||
FAR_model(n+1,q*M+p+1) = exp(1i*2*pi*p/M*Cn+1i*2*pi*q/N*n*(1+Cn*epi));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
x = zeros(M,N);
|
||||
col = randperm(N,k);
|
||||
x(:,col) = randn(M,k) + 1i*randn(M,k);
|
||||
y = FAR_model * x(:) + (randn(N,1)+1i*randn(N,1))*noise(noise_k);
|
||||
|
||||
cvx_begin
|
||||
variable x_e(M,N) complex
|
||||
norm21 = 0;
|
||||
for i = 1:N
|
||||
norm21 = norm21 + norm(FAR_model(:,(i-1)*M+1:i*M)*x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
norm(FAR_model*x_e(:) - y) <= sqrt(N)*noise(noise_k);
|
||||
cvx_end
|
||||
contri2 = zeros(N,1);
|
||||
re_err = zeros(N,1);
|
||||
for i = 1:N
|
||||
if ismember(i,col)
|
||||
re_err = re_err+FAR_model(:,(i-1)*M+1:i*M)*(x_e(:,i));
|
||||
end
|
||||
contri2(i) = norm(FAR_model(:,(i-1)*M+1:i*M)*(x_e(:,i)));
|
||||
end
|
||||
re1(k,noise_k) = re1(k,noise_k) +norm(FAR_model*x(:)-re_err)/norm(FAR_model*x(:));
|
||||
con1(k,noise_k) = con1(k,noise_k) + 1-sum(contri2(col))/sum(contri2);
|
||||
|
||||
|
||||
cvx_begin
|
||||
variable x_e(M,N) complex
|
||||
norm21 = 0;
|
||||
for i = 1:N
|
||||
norm21 = norm21 + norm(x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
norm(FAR_model*x_e(:) - y) <= sqrt(N)*noise(noise_k);
|
||||
cvx_end
|
||||
re_err = zeros(N,1);
|
||||
contri2 = zeros(N,1);
|
||||
for i = 1:N
|
||||
if ismember(i,col)
|
||||
re_err = re_err+FAR_model(:,(i-1)*M+1:i*M)*(x_e(:,i));
|
||||
end
|
||||
contri2(i) = norm(FAR_model(:,(i-1)*M+1:i*M)*(x_e(:,i)));
|
||||
end
|
||||
re2(k,noise_k) = re2(k,noise_k) +norm(FAR_model*x(:)-re_err)/norm(FAR_model*x(:));
|
||||
con2(k,noise_k) = con2(k,noise_k) + 1-sum(contri2(col))/sum(contri2);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
save("FAR_noise_0206.mat")
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
%初值设定
|
||||
N = 64; %最大行数
|
||||
D = 32; %块数
|
||||
m = 4; %块的列数
|
||||
d = 2; %块内rank/维度
|
||||
result = zeros(N,D); %保留结果
|
||||
%按行数循环
|
||||
for n = 1:N
|
||||
A = zeros(n,m*D);
|
||||
B = zeros(n,d*D);
|
||||
%按稀疏度循环
|
||||
for k = 1:D
|
||||
%50次重复实验
|
||||
for j = 1:50
|
||||
re_err = 0;
|
||||
for i = 0:D-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
tmp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*tmp;
|
||||
|
||||
B(:,d*i+1:d*i+d) = set;
|
||||
end
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:);
|
||||
|
||||
%凸优化利用l21范数求解基集下的恢复问题
|
||||
cvx_begin
|
||||
variable x_e(d,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
B*x_e(:) == y
|
||||
cvx_end
|
||||
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(B(:,(i-1)*d+1:i*d)*x_e(:,i)-A(:,(i-1)*m+1:i*m)*x(:,i));
|
||||
end
|
||||
if re_err<10e-4
|
||||
result(n,k) = result(n,k)+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
save('gaussD32m2d2base.mat');
|
||||
@@ -0,0 +1,55 @@
|
||||
%初值设定
|
||||
N = 64; %最大行数
|
||||
D = 32; %块数
|
||||
m = 4; %块的列数
|
||||
d = 2; %块内rank/维度
|
||||
result = zeros(N,D); %保留结果
|
||||
|
||||
%按行数循环
|
||||
for n = 1:N
|
||||
A = zeros(n,m*D);
|
||||
B = zeros(n,d*D);
|
||||
%按稀疏度循环
|
||||
for k = 1:D
|
||||
%50次重复实验
|
||||
for j = 1:50
|
||||
re_err = 0;
|
||||
for i = 0:D-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
tmp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*tmp;
|
||||
%随机挑选块列向量作为降维后矩阵
|
||||
q = randperm(m,d);
|
||||
B(:,d*i+1:d*i+d) = A(:,m*i+q);
|
||||
end
|
||||
%生成稀疏块信号
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:);
|
||||
%凸优化利用特殊l21范数求解降维后的恢复问题
|
||||
cvx_begin
|
||||
variable x_e(d,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(B(:,(i-1)*d+1:i*d)*x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
B*x_e(:) == y
|
||||
cvx_end
|
||||
|
||||
%得到重建效果
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(B(:,(i-1)*d+1:i*d)*x_e(:,i)-A(:,(i-1)*m+1:i*m)*x(:,i));
|
||||
end
|
||||
if re_err<10e-4
|
||||
result(n,k) = result(n,k)+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
save('gaussD32m2d2randalter.mat');
|
||||
@@ -0,0 +1,53 @@
|
||||
%初值设定
|
||||
N = 64; %最大行数
|
||||
D = 32; %块数
|
||||
m = 4; %块的列数
|
||||
d = 2; %块内rank/维度
|
||||
result = zeros(N,D); %保留结果
|
||||
%按行数循环
|
||||
for n = 1:N
|
||||
A = zeros(n,m*D);
|
||||
B = zeros(n,d*D);
|
||||
%按稀疏度循环
|
||||
for k = 1:D
|
||||
%50次重复实验
|
||||
for j = 1:50
|
||||
re_err = 0;
|
||||
for i = 0:D-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
tmp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*tmp;
|
||||
q = randperm(m,d);
|
||||
B(:,d*i+1:d*i+d) = A(:,m*i+q);
|
||||
end
|
||||
%随机挑选块列向量作为降维后矩阵
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:);
|
||||
%凸优化利用l21范数求解降维后的恢复问题
|
||||
cvx_begin
|
||||
variable x_e(d,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
B*x_e(:) == y
|
||||
cvx_end
|
||||
|
||||
%得到重建效果
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(B(:,(i-1)*d+1:i*d)*x_e(:,i)-A(:,(i-1)*m+1:i*m)*x(:,i));
|
||||
end
|
||||
if re_err<10e-4
|
||||
result(n,k) = result(n,k)+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
save('gaussD32m2d2rand.mat');
|
||||
@@ -0,0 +1,52 @@
|
||||
%初值设定
|
||||
N = 64; %最大行数
|
||||
D = 32; %块数
|
||||
m = 4; %块的列数
|
||||
d = 2; %块内rank/维度
|
||||
result = zeros(N,D); %保留结果
|
||||
%按行数循环
|
||||
for n = 1:N
|
||||
A = zeros(n,m*D);
|
||||
B = zeros(n,d*D);
|
||||
%按稀疏度循环
|
||||
for k = 1:D
|
||||
%50次重复实验
|
||||
for j = 1:50
|
||||
re_err = 0;
|
||||
for i = 0:D-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
|
||||
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
temp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*temp;
|
||||
end
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:);
|
||||
|
||||
%凸优化利用特殊l21范数求解恢复问题
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(A(:,(i-1)*m+1:i*m)*x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
A*x_e(:) == y
|
||||
cvx_end
|
||||
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A(:,(i-1)*m+1:i*m)*(x_e(:,i)-x(:,i)));
|
||||
end
|
||||
if re_err<10e-4
|
||||
result(n,k) = result(n,k)+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
save('gaussD32m4d2alter.mat');
|
||||
@@ -0,0 +1,51 @@
|
||||
%初值设定
|
||||
N = 64; %最大行数
|
||||
D = 32; %块数
|
||||
m = 4; %块的列数
|
||||
d = 2; %块内rank/维度
|
||||
result = zeros(N,D); %保留结果
|
||||
%按行数循环
|
||||
for n = 1:N
|
||||
A = zeros(n,m*D);
|
||||
B = zeros(n,d*D);
|
||||
%按稀疏度循环
|
||||
for k = 1:D
|
||||
%50次重复实验
|
||||
for j = 1:50
|
||||
re_err = 0;
|
||||
for i = 0:D-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
temp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*temp;
|
||||
end
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:);
|
||||
%凸优化利用l21范数求解恢复问题
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
A*x_e(:) == y
|
||||
cvx_end
|
||||
|
||||
|
||||
%得到重建效果
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A(:,(i-1)*m+1:i*m)*(x_e(:,i)-x(:,i)));
|
||||
end
|
||||
if re_err<10e-4
|
||||
result(n,k) = result(n,k)+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
save('gaussD32m4d2class.mat');
|
||||
@@ -0,0 +1,24 @@
|
||||
N = 40; %行数
|
||||
D = 32; %块数
|
||||
m = 4; %块的列数
|
||||
d = 2; %块内rank/维度
|
||||
resulta = zeros(5000,1);
|
||||
resultb = zeros(5000,1);
|
||||
%resulta = zeros(5,20,50); %保留结果
|
||||
%resultb = zeros(5,20,50);
|
||||
%按行数循环
|
||||
A = zeros(N,m*D);
|
||||
B = zeros(N,d*D);
|
||||
%按稀疏度循环
|
||||
n = N;
|
||||
parfor i = 0:199
|
||||
t = floor(i/1000) + 1;
|
||||
k = floor(mod(i,1000)/50)+1;
|
||||
j = mod(i,50)+1;
|
||||
[a,b] = test(t,k,j);
|
||||
resulta(i+1) = a;
|
||||
resultb(i+1) = b;
|
||||
end
|
||||
resulta = reshape(resulta,5,20,50);
|
||||
resultb = reshape(resultb,5,20,50);
|
||||
save('gaussnoise.mat');
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
load("result1.mat");
|
||||
%ambient_dim = 100;
|
||||
%sparsities = 1:100;
|
||||
d = 32;%¿é¸öÊý
|
||||
m = 2;%¿éÄÚÔªËØÊý
|
||||
l1recovery = zeros(100,1);
|
||||
for i = 1:32
|
||||
l1recovery(i) = theoretic(m,i,d);
|
||||
end
|
||||
m = 1:32;
|
||||
n = 1:64;
|
||||
figure;
|
||||
contourf( m, n, result, 20, 'LineColor', 'none' );
|
||||
hold on
|
||||
cbar = colorbar;
|
||||
myplot2 = plot( n, l1recovery, 'Color', 'w', 'Linewidth', 3 );
|
||||
mylegend2 = legend(myplot2, ' Theory', 'Location', 'SouthEast' );
|
||||
mylegend2.Box = 'off';
|
||||
mylegend2.TextColor = [1,1,1];
|
||||
mylegend2.FontSize = 12;
|
||||
|
||||
figure
|
||||
plot(con1(:,1)/400,'*-')
|
||||
xlabel("\fontname{Times New Roman} Block Sparsity \it K");
|
||||
ylabel("\fontname{Times New Roman} Block Contribution Error");
|
||||
savefig("contri_noise001.fig");
|
||||
saveas(gca,"contri_noise001.eps");
|
||||
|
||||
figure
|
||||
plot(con1(:,2)/400,'*-')
|
||||
xlabel("\fontname{Times New Roman} Block Sparsity \it K");
|
||||
ylabel("\fontname{Times New Roman} Block Contribution Error");
|
||||
savefig("contri_noise01.fig");
|
||||
saveas(gca,"contri_noise01.eps");
|
||||
|
||||
figure
|
||||
plot(re1(:,1)/400,'*-')
|
||||
xlabel("\fontname{Times New Roman} Block Sparsity \it K");
|
||||
ylabel("\fontname{Times New Roman} Reconstruction Error");
|
||||
savefig("re_noise001.fig");
|
||||
saveas(gca,"re_noise001.eps");
|
||||
|
||||
figure
|
||||
plot(re1(:,2)/400,'*-')
|
||||
xlabel("\fontname{Times New Roman} Block Sparsity \it K");
|
||||
ylabel("\fontname{Times New Roman} Reconstruction Error");
|
||||
savefig("re_noise01.fig");
|
||||
saveas(gca,"re_noise01.eps");
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,228 @@
|
||||
%function[out1,out2,out3,out4,out5,out6] = test(t,k,~)
|
||||
|
||||
%sigma = [0,0.01, 0.5, 1, 1.5, 2];
|
||||
n = 40;
|
||||
d = 2;
|
||||
D = 32;
|
||||
m = 4;
|
||||
%t = 1;
|
||||
k = 13;
|
||||
|
||||
err = zeros(20,1);
|
||||
|
||||
A = zeros(n,D*m);
|
||||
contri1 = zeros(n,D);
|
||||
contri2 = zeros(n,D);
|
||||
for i = 0:32-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
temp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*temp*(i+1);
|
||||
end
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:);
|
||||
|
||||
weight = diag(rand(D*m,1)*30);
|
||||
%A2 = zeros(n,D*m);
|
||||
%for i= 0:31
|
||||
% A2(:,m*i+1:m*i+m) = A(:,m*i+1:m*i+m) * weight(i+1);
|
||||
%end
|
||||
A2 = A*weight;
|
||||
|
||||
%凸优化利用特殊l21范数求解恢复问题
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(A(:,(i-1)*m+1:i*m)*x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
A*x_e(:) == y;
|
||||
cvx_end
|
||||
re_err = 0;
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A(:,(i-1)*m+1:i*m)*(x_e(:,i)-x(:,i)));
|
||||
contri1(:,i) = A(:,(i-1)*m+1:i*m)*(x_e(:,i));
|
||||
end
|
||||
out1 = re_err;
|
||||
x3 = x_e;
|
||||
|
||||
|
||||
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(A2(:,(i-1)*m+1:i*m)*x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
A2*x_e(:) == y;
|
||||
cvx_end
|
||||
re_err = 0;
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A2(:,(i-1)*m+1:i*m)*(x_e(:,i)-inv(weight((i-1)*m+1:i*m,(i-1)*m+1:i*m))*x(:,i)));
|
||||
contri2(:,i) = A2(:,(i-1)*m+1:i*m)*(x_e(:,i));
|
||||
end
|
||||
out2 = re_err;
|
||||
%err(iter) =norm(contri1-contri2,'fro');
|
||||
|
||||
|
||||
a1 = 0;
|
||||
a2 = 0;
|
||||
for i = 1:32
|
||||
a1 = a1 +norm(contri1(:,i));
|
||||
a2 = a2 +norm(contri1(:,i));
|
||||
end
|
||||
|
||||
|
||||
% cvx_begin
|
||||
% variable x_e(m,D)
|
||||
% norm21 = 0;
|
||||
% for i = 1:D
|
||||
% norm21 = norm21 + norm(A2(:,(i-1)*m+1:i*m)*x_e(:,i));
|
||||
% end
|
||||
% minimize(norm21)
|
||||
% subject to
|
||||
% A2*x_e(:) == y;
|
||||
% cvx_end
|
||||
% re_err = 0;
|
||||
% for i = 1:D
|
||||
% re_err = re_err+norm(A2(:,(i-1)*m+1:i*m)*(x_e(:,i)-inv(weight((i-1)*m+1:i*m,(i-1)*m+1:i*m))*x(:,i)));
|
||||
% contri2(:,i) = A2(:,(i-1)*m+1:i*m)*(x_e(:,i));
|
||||
% end
|
||||
% out2 = re_err;
|
||||
%%
|
||||
n = 40;
|
||||
d = 2;
|
||||
D = 32;
|
||||
m = 4;
|
||||
%t = 1;
|
||||
k = 4;
|
||||
A = zeros(n,D*m);
|
||||
contri1 = zeros(n,D);
|
||||
contri2 = zeros(n,D);
|
||||
for i = 0:32-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
temp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*temp*(i+1);
|
||||
end
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:);
|
||||
|
||||
A2 = A * diag(randn(D*m,1)*30);
|
||||
|
||||
%凸优化利用特殊l21范数求解恢复问题
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
A*x_e(:) == y;
|
||||
cvx_end
|
||||
re_err = 0;
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A(:,(i-1)*m+1:i*m)*(x_e(:,i)-x(:,i)));
|
||||
contri1(:,i) = A(:,(i-1)*m+1:i*m)*(x_e(:,i));
|
||||
end
|
||||
out1 = re_err;
|
||||
|
||||
|
||||
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
A2*x_e(:) == y;
|
||||
cvx_end
|
||||
re_err = 0;
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A2(:,(i-1)*m+1:i*m)*(x_e(:,i)-inv(weight((i-1)*m+1:i*m,(i-1)*m+1:i*m))*x(:,i)));
|
||||
contri2(:,i) = A2(:,(i-1)*m+1:i*m)*(x_e(:,i));
|
||||
end
|
||||
out2 = re_err;
|
||||
%%
|
||||
n = 40;
|
||||
d = 2;
|
||||
D = 32;
|
||||
m = 4;
|
||||
%t = 1;
|
||||
k = 6;
|
||||
A = zeros(n,D*m);
|
||||
noise = 0.01;
|
||||
contri1 = zeros(n,D);
|
||||
contri2 = zeros(n,D);
|
||||
for i = 0:32-1
|
||||
%生成高斯基集
|
||||
set = randn(n,d);
|
||||
%生成随机的模为1的向量,与基集相乘得到块不满秩的高斯矩阵
|
||||
theta = rand(1,4)*2*pi;
|
||||
temp = [sin(theta);cos(theta)];
|
||||
A(:,m*i+1:m*i+m) = set*temp*(i+1);
|
||||
end
|
||||
x = zeros(m,D);
|
||||
col = randperm(D,k);
|
||||
x(:,col) = randn(m,k);
|
||||
y = A * x(:) + randn(n,1)*noise;
|
||||
|
||||
weight = diag(rand(D*m,1)*30);
|
||||
%A2 = zeros(n,D*m);
|
||||
%for i= 0:31
|
||||
% A2(:,m*i+1:m*i+m) = A(:,m*i+1:m*i+m) * weight(i+1);
|
||||
%end
|
||||
A2 = A*weight;
|
||||
|
||||
%凸优化利用特殊l21范数求解恢复问题
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(A(:,(i-1)*m+1:i*m)*x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
norm(A*x_e(:) - y) <= sqrt(40)*0.01;
|
||||
cvx_end
|
||||
re_err = 0;
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A(:,(i-1)*m+1:i*m)*(x_e(:,i)-x(:,i)));
|
||||
contri1(:,i) = A(:,(i-1)*m+1:i*m)*(x_e(:,i));
|
||||
end
|
||||
out1 = re_err;
|
||||
|
||||
|
||||
|
||||
cvx_begin
|
||||
variable x_e(m,D)
|
||||
norm21 = 0;
|
||||
for i = 1:D
|
||||
norm21 = norm21 + norm(A2(:,(i-1)*m+1:i*m)*x_e(:,i));
|
||||
end
|
||||
minimize(norm21)
|
||||
subject to
|
||||
norm(A2*x_e(:) - y) <= sqrt(40)*0.01;
|
||||
cvx_end
|
||||
re_err = 0;
|
||||
for i = 1:D
|
||||
re_err = re_err+norm(A2(:,(i-1)*m+1:i*m)*(x_e(:,i)-inv(weight((i-1)*m+1:i*m,(i-1)*m+1:i*m))*x(:,i)));
|
||||
contri2(:,i) = A2(:,(i-1)*m+1:i*m)*(x_e(:,i));
|
||||
end
|
||||
out2 = re_err;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
function n = theoretic(m,s,d)
|
||||
syms t;
|
||||
syms u;
|
||||
f = s*(m+t^2)+(d-s)*int((u-t)^2*u^(m-1)*exp(-u^2/2)/(2^(m/2-1)*gamma(m/2)),u,t,inf);
|
||||
g = diff(f,t);
|
||||
t1 = solve(g);
|
||||
n = s*(m+t1^2)+(d-s)*int((u-t1)^2*u^(m-1)*exp(-u^2/2)/(2^(m/2-1)*gamma(m/2)),u,t1,inf);
|
||||
@@ -0,0 +1,147 @@
|
||||
|
||||
len = 256;
|
||||
w = 0.05;
|
||||
m = [0:len-1];
|
||||
n = m;
|
||||
B = m - n';
|
||||
B = (sin(2*pi*w*B)./(pi*B));
|
||||
for i = 1:len
|
||||
B(i,i) = 2*w;
|
||||
end
|
||||
t = [0:0.1:25.5];
|
||||
r = 1/sqrt(2*pi*1)*exp(-t.^2/2*1);
|
||||
gau = toeplitz(r);
|
||||
|
||||
|
||||
|
||||
|
||||
%%
|
||||
len = 64;
|
||||
w = 0.2;
|
||||
m = [0:len-1];
|
||||
n = m;
|
||||
B = m - n';
|
||||
B_new = sin(2*pi*w*B)./(pi*B);
|
||||
for i = 1:len
|
||||
B_new(i,i) = 2*w;
|
||||
end
|
||||
|
||||
cor = 0.236;
|
||||
|
||||
final = zeros(len^2,len^2);
|
||||
for j = 1:len
|
||||
for k = 1:len
|
||||
tmp = sin(2*pi*w*(cor*B+(j-k)))./(pi*(cor*B+(j-k)));
|
||||
tmp(cor*B+(j-k) == 0) = 2*w;
|
||||
final((j-1)*len+1:j*len,(k-1)*len+1:k*len) = tmp.*B_new;
|
||||
end
|
||||
end
|
||||
|
||||
[a,b] = eig(final);
|
||||
plot(diag(b));
|
||||
c = diag(b);
|
||||
M = c'*c;
|
||||
plot(sort(M(:)));
|
||||
|
||||
|
||||
|
||||
%%
|
||||
|
||||
K = kron(B,B);
|
||||
|
||||
[a,b] = eig(B);
|
||||
plot(diag(b));
|
||||
c = diag(b);
|
||||
M = c*c';
|
||||
plot(sort(M(:)));
|
||||
|
||||
|
||||
f = zeros(1,1200);
|
||||
f(1:120) = randn(120,1);
|
||||
f(1081:1200) = randn(120,1);
|
||||
t = ifft(f);
|
||||
t = t(1:64);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%B = B + diag(exp(1i*2*pi*0.3*[0:len-1]))*B*diag(exp(1i*2*pi*0.3*[0:len-1]))';
|
||||
|
||||
[a,b] = eig(B);
|
||||
% plot(sort(abs(diag(b))))
|
||||
|
||||
D = B(1:8,:);
|
||||
E = B(1:2:16,:);
|
||||
[U2,S2,V2] = svd(D);
|
||||
[U3,S3,V3] = svd(E);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%sel = (1:2:1023);
|
||||
o = randn(1024,1024);
|
||||
%o = orth(o);
|
||||
sel = randperm(1024,512);
|
||||
% C = o(sel,:)*b;
|
||||
% D = B(sel,:);
|
||||
% E = o(sel,randperm(1024,204));
|
||||
D = B(1:512,:);
|
||||
C = B(sel,:);
|
||||
E = B(1:2:1023,:);
|
||||
[U,S,V] = svd(C);
|
||||
[U2,S2,V2] = svd(D);
|
||||
[U3,S3,V3] = svd(E);
|
||||
s = diag(S);
|
||||
s2 = diag(S2);
|
||||
s3 = diag(S3);
|
||||
figure;
|
||||
subplot(1,4,1);
|
||||
plot(s);
|
||||
subplot(1,4,2);
|
||||
plot(s2);
|
||||
subplot(1,4,3);
|
||||
plot(s3);
|
||||
q = sum(s);
|
||||
subplot(1,4,4);
|
||||
plot(flipud(abs(diag(b))));
|
||||
|
||||
|
||||
%t1 = squeeze(resulta(:,:,1));
|
||||
%t2 = squeeze(resultb(:,:,1));
|
||||
% t1 = squeeze(resulta(:,:,2));
|
||||
% t2 = squeeze(resultb(:,:,2));
|
||||
% figure;
|
||||
|
||||
result_cona = reshape(result_cona,200,20,2);
|
||||
result_conb = reshape(result_conb,200,20,2);
|
||||
for i = 1:2
|
||||
t1 = squeeze(result_cona(:,:,i)+t3(:,:,i))/2;
|
||||
t2 = squeeze(result_conb(:,:,i)+t4(:,:,i))/2;
|
||||
figure
|
||||
hold on
|
||||
plot(mean(t1),'-r.');
|
||||
plot(mean(t2),'-bo');
|
||||
h = legend("$P_{\ell_{2,1}}'$","$P_{\ell_{2,1}}$","Location","Southeast","Fontsize",15);
|
||||
set(h,'Interpreter','latex');
|
||||
xlabel("\fontname{Times New Roman} Block Sparsity \it s_B");
|
||||
ylabel("\fontname{Times New Roman} Block Contribution Error");
|
||||
end
|
||||
|
||||
|
||||
xlabel("\fontname{Times New Roman} Block Sparsity \it K");
|
||||
ylabel("\fontname{Times New Roman} Block Contribution Error");
|
||||
|
||||
|
||||
t3 = result_cona;
|
||||
t4 = result_conb;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user