Add example (From lyh)
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
close all;
|
||||
clear all;
|
||||
clc;
|
||||
M = 4;
|
||||
N = 128;
|
||||
%block_sparsity = 1;
|
||||
tol = 1e-5;
|
||||
trial = 20;
|
||||
epi = 0.02;
|
||||
result = zeros(N,25);
|
||||
for col = 4:N
|
||||
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');
|
||||
@@ -0,0 +1,47 @@
|
||||
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 = 1:25
|
||||
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
|
||||
minimize(norm(x,1))
|
||||
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('FARepsilon.mat');
|
||||
@@ -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,27 @@
|
||||
N = 100;
|
||||
gauss_phase_res = zeros(100,100);
|
||||
for col = 1:100
|
||||
%¾ØÕóÉú³É
|
||||
for p =1:100
|
||||
suc = 0;
|
||||
for loop = 1:50
|
||||
x1 = zeros(N,1);
|
||||
q = randperm(N,p);
|
||||
x1(q) = randn(p,1);
|
||||
fai = randn(col,N);
|
||||
b = fai*x1;
|
||||
cvx_begin quiet
|
||||
variable x(N)
|
||||
minimize( norm( x, 1 ) )
|
||||
subject to
|
||||
fai * x == b
|
||||
cvx_end
|
||||
%disp((norm(x-x1,1)))
|
||||
if (norm(x-x1,1))<10e-5
|
||||
suc = suc+1;
|
||||
end
|
||||
end
|
||||
gauss_phase_res(col,p)=suc/50;
|
||||
end
|
||||
end
|
||||
save gauss_phase_real;
|
||||
Reference in New Issue
Block a user