clear all;close all;clc;
%参数配置初始化
CNT = 1000;%对于每组(K,M,N),重复迭代次数
N = 500;%信号x的长度
Psi = eye(N);%x本身是稀疏的,定义稀疏矩阵为单位阵x=Psi*theta
K = 20;%测量值集合
M_set = [60,70,80,90,100,110,120,130,140,150];
L = 5;
Percentage = zeros(3,length(M_set));%存储恢复成功概率
%主循环,遍历每组(K,M,N)
tic
for mm = 1:length(M_set)
M = M_set(mm);%本次测量值个数
P1 = 0;
P2 = 0;
P3 = 0;
for cnt = 1:CNT %每个观测值个数均运行CNT次
Index_K = randperm(N);
x = zeros(N,1);
x(Index_K(1:K)) = 5*randn(K,1);%x为K稀疏的,且位置是随机的
Phi = randn(M,N);%测量矩阵为高斯矩阵
A = Phi * Psi;%传感矩阵
y = Phi * x;%得到观测向量y
theta_lab = LABOMP_f(y,A,K,L);
theta_la = LAOMP_f(y,A,K,L);
theta = CS_OMP(y,A,K);%恢复重构信号theta
x_r_lab = Psi * theta_lab;% x=Psi * theta
x_r_la = Psi * theta_la;% x=Psi * theta
x_r = Psi * theta;% x=Psi * theta
if norm(x_r_lab-x)<1e-6%如果残差小于1e-6则认为恢复成功
P1 = P1 + 1;
end
if norm(x_r_la-x)<1e-6%如果残差小于1e-6则认为恢复成功
P2 = P2 + 1;
end
if norm(x_r-x)<1e-6%如果残差小于1e-6则认为恢复成功
P3 = P3 + 1;
end
end
Percentage(1,mm) = (P1/CNT)*100;%计算labomp恢复概率
Percentage(2,mm) =(P2/CNT)*100;%计算laomp恢复概率
Percentage(3,mm) = (P3/CNT)*100;%计算omp恢复概率
end
toc
save KtoPercentage1000test %运行一次不容易,把变量全部存储下来
%绘图
S = ['-ks';'-ko';'-kd'];
figure;
for mm = 1:3
MM = 60:10:150;
plot(MM,Percentage(mm,1:length(M_set)),S(mm,:));%绘出x的恢复信号
hold on;
end
hold off;
xlim([58 152]);
legend('LABOMP','LAOMP','OMP');
xlabel('观测数M');
ylabel('重构概率');
title('N = 256 K = 20情况下,观测数M不同对重构概率的影响');
- 1
- 2
- 3
前往页