%Compressed Sensing / Compressive Sensing
clc;
clear;
close all;
warning off;
addpath(genpath(pwd));
rng('default');
%计数器
tic
l=8;
c=8;
S=5;
% m is the number of measurement
%m=20;
A=5:20;
D=zeros(size(A));
D2=D;
Dmod=D;
D1=D;
%Dp5=D;
Dmod3=D;
Dco=D;
%Monte Carlo
Dsp=D;
for t=1:200
rng(t);
for k=1:length(D)
m = A(k);
[t,k]
r2 = randperm(l*c);r2=r2(1:S);rr2=r2(:);
u_true = zeros(l*c,1); u_true(r2)=u_true(r2)+rand(S,1);
phi = (kron((fft(eye(c))).',fft(eye(l))));
r = randperm(l*c);r=r(1:m);
phi = phi(r,:);
b = phi * u_true(:);
[d1,u_new1] = IRLSregcomp(phi,b,1,u_true(:));
[uestOMP,d2] = OMP(phi,b,u_true,S);
[uestOMPmod3,dmod3] = OMPmod3(phi,b,u_true,S);
[uestco,dco] = cosamp2(phi,b,u_true,S);
[uestsp,dsp] = SPA(phi,S,b,u_true);
Dsp(k)=Dsp(k)+dsp;
Dco(k)=Dco(k)+dco;
Dmod3(k)=Dmod3(k)+dmod3;
D2(k)=D2(k)+d2;
D1(k)=D1(k)+d1;
end
end;
D1=D1/t;
Dco=Dco/t;
Dsp=Dsp/t;
Dmod=Dmod/t;
Dmod3=Dmod3/t;
D2=D2/t;
figure(1)
hold off
hold on
plot(A,D1,'k*--','LineWidth',2)
plot(A,D2,'m*--','LineWidth',2)
plot(A,Dmod3,'r*--','LineWidth',2)
plot(A,Dsp,'g*--','LineWidth',2)
plot(A,Dco,'o--','LineWidth',2)
legend('IRLS p=1','OMP','modified OMP','SP','CoSaMP')
grid
xlabel('Number of measurements M')
ylabel('Empirical probability of reconstruction at level 1e-3')
title('N=64 S=5 \Phi : undersampled DFT')
- 1
- 2
前往页