通信人家园
标题:
ASSP算法实现
[查看完整版帖子]
[打印本页]
时间:
2016-10-8 19:34
作者:
fdd566
标题:
ASSP算法实现
function[DD] = CS_ASSP2(Y,P,pth)
load data1;
%step1
s = 1;
k = 1;
Is_k1 = [];
R_k1 = Y;
R_s = +inf;
D_k1 = 0;
DD = zeros(M*L,R);
%step2
while 1
%(1)correlation
Z = P'*R_k1;
%(2)support estimate
for i = 1:L
F_Z(i) = norm(Z((i-1)*M+1:i*M,:));
end
[val,pos] = sort(F_Z,'descend');
Is_bpk = union(Is_k1,pos(1:s));
%(3)support pruning
%D = zeros(M*L,R);
P_Is_bpk = [];
for i = 1:size(Is_bpk,2)
P_Is_bpk(:,(i-1)*M+1:i*M) = P(:,(Is_bpk(i)-1)*M+1:Is_bpk(i)*M);
end
D_Is_bpk = pinv(P_Is_bpk)*Y;%theta_Is
F_D = [];
for i = 1:size(Is_bpk,2)
F_D(i) = norm(D_Is_bpk((i-1)*M+1:i*M,:));
end
[val,pos] = sort(F_D,'descend');
Is_bk = Is_bpk(pos(1:s));
%(4)matrix estimate
P_Is_bk = [];
for i = 1:size(Is_bk,2)
P_Is_bk(:,(i-1)*M+1:i*M) = P(:,(Is_bk(i)-1)*M+1:Is_bk(i)*M);
end
D_Is_bk = pinv(P_Is_bk)*Y;
%(5)residue update
R_k = Y - P_Is_bk*D_Is_bk;
%(6)matrix update
if norm(R_k1) > norm(R_k)
%(7)Iteration with fixed sparsity level
Is_k1 = Is_bk;
R_k1 = R_k;
D_k1 = D_Is_bk;
k = k+1;
else
%(8)update sparsity level
D_s = D_k1;
R_s = R_k1;
Is_s = Is_k1;
s = s+1;
end
%condition 1
if (norm(R_k) > norm(R_s)) && (norm(R_s) < 1)
fprintf('condition 1\n');
break;
end
%condition 1 end
%condition 2
F_D_s = [];
for i = 1:size(Is_bk,2)
F_D_s(i) = norm(D_Is_bk((i-1)*M+1:i*M,:));
end
[val,pos] = sort(F_D_s,'ascend');
if val(1) <= sqrt(M*R)*pth
fprintf('condition 2\n');
break;
end
%condition 2 end
end
for i = 1:size(Is_s,2)
DD((Is_s(i)-1)*M+1:Is_s(i)*M,:) = D_s((i-1)*M+1:i*M,:);
end
end
复制代码
利用ofdm符合间的H具有相同的支撑集,以及不同天线具有共同支撑集实现的sp算法的改进 下面是测试程序。
clear all;close all;clc;
M = 32;%观测值个数(长度)
N = 4096;
K = 6;%稀疏度
L = 64;
Np = round(N*0.17);
R = 1;
%Np = round(Eita_p*N)
save data1 M N K L N R;
SNR_val = 30;
pth = 0.1;
for i = 1:16
MSE_singel_val = [];
Eita_p_singel_val = [];
for j = 1:20
D = CS_D();
[MSE_singel_val(j),Eita_p_singel_val(j)] = MSE_Eita(D,Np,SNR_val,pth);
end
MSE_val(i) = sum(MSE_singel_val)/20
Eita_p_val(i) = Eita_p_singel_val(1);
Np = Np + floor((N*0.21 - N*0.17)/16);
end
SNR_val = 20;
pth = 0.05;
Np = round(N*0.17);
for i = 1:16
MSE_singel_val = [];
Eita_p_singel_val = [];
for j = 1:20
D = CS_D();
[MSE_singel_val(j),Eita_p_singel_val(j)] = MSE_Eita(D,Np,SNR_val,pth);
end
MSE_val_2(i) = sum(MSE_singel_val)/20
Eita_p_val_2(i) = Eita_p_singel_val(1);
Np = Np + floor((N*0.21 - N*0.17)/16);
end
SNR_val = 10;
pth = 0.05;
Np = round(N*0.17);
for i = 1:16
MSE_singel_val = [];
Eita_p_singel_val = [];
for j = 1:20
D = CS_D();
[MSE_singel_val(j),Eita_p_singel_val(j)] = MSE_Eita(D,Np,SNR_val,pth);
end
MSE_val_3(i) = sum(MSE_singel_val)/20
Eita_p_val_3(i) = Eita_p_singel_val(1);
Np = Np + floor((N*0.21 - N*0.17)/16);
end
figure;
semilogy(Eita_p_val,MSE_val,'-ro');%绘制
axis([0.17 0.20 1.0e-04 1.0e01]);
grid on;
hold on;
semilogy(Eita_p_val_2,MSE_val_2,'-b+');%绘制
hold on;
semilogy(Eita_p_val_3,MSE_val_3,'-k*');%绘制
hold off;
legend('SNR_30','SNR_20','SNR_10');
复制代码
通信人家园 (https://www.txrjy.com/)
Powered by C114