1.软件版本
MATLAB2013b
2.本算法理论知识
算法源于文献:
?
3.部分核心代码
clc;
clear;
close all;
warning off;
Num_Sensor = 16;
Num_signal = 2;
Num_babe = 2;
b = zeros(Num_Sensor,1);
H = zeros(Num_Sensor,Num_signal);
DOA = zeros(Num_signal,1);
wavelength = 0.06;
Iteration = 1:1:20;
SNR = 12;
d = 0.5*wavelength*ones(Num_Sensor,1);%阵元间距
f = zeros(Num_signal,1);
f(1) = 1;
Len_Signal = 100000;
Len_train = round(0.01*Len_Signal);
%设置延迟长度
Len_delays = round(0.05*Len_Signal);
Train_Signal = zeros(Num_signal,Len_train);
Train_Noise = zeros(Num_Sensor,Len_train);
%信号和噪声以及反射信号和反射噪声
Signal = zeros(Num_signal,Len_Signal);
Noise = zeros(Num_Sensor,Len_Signal);
%全值,LCMV不需要进行迭代更新
W = zeros(Num_Sensor,1);
%根据所提供的场景,设置各个入射信号的方位角
DOA = [0,pi-atan(2)];
%根据场景设置H(tableI算法为H已知,所以根据场景来设置)
for jj=1:Num_signal
for ii=1:Num_Sensor
b(ii)=exp(-j*2*pi*(ii-1)*d(ii)*sin(DOA(jj))/wavelength) ;
end
H(:,jj)=b/(b'*b)^0.5;
end
%产生两路随机信号
Signalo = randint(Num_signal,Len_Signal);
Signalo = 2*(Signalo-0.5);
%反射信号
for i = 1:Num_signal
Signal_reflect(i,:) = 0.2*[zeros(1,Len_delays),Signal(i,1:Len_Signal-Len_delays)];
end
Signal = Signalo;
%产生babe噪声源
babble = randn(Num_signal,Len_Signal)+j*randn(Num_signal,Len_Signal);
babble = 2*(babble-0.5);
for i = 1:Num_signal
babble_reflect(i,:) = 0.2*[zeros(1,Len_delays),babble(i,1:Len_Signal-Len_delays)];
end
%实际输入到麦克风的声源
Signal = (Signalo + Signal_reflect + babble + babble_reflect)/4;
%传感器之间的噪声干扰
Noise = randn(Num_Sensor,Len_Signal)+j*randn(Num_Sensor,Len_Signal);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SNRs = zeros(1,length(Iteration));
%在几种不同的信噪比下计算误码率
diBi = 1/(2*10^(SNR/10))^0.5;
Noise = Noise*diBi;
for Iter = Iteration
Iter
Train_Signal = Signal(:,(1:Len_train));
Train_Noise = Noise(:,(1:Len_train));
x = H*Train_Signal + Train_Noise; %加噪声
x1 = H*Signal + Noise; %加噪声
%LCMV
R = x*x';
W = inv(R)*H*inv((H'*inv(R)*H))*f;
y = W'*x1;
%以第一个信号源为准计算,如果是第二个信号源,也是同样处理
%计算SNR值
SNRs(Iter) = 10*log10(mean(abs(y(1,:)).^2)/mean(abs(Noise(1,:)).^2));
%计算SDR值
SDRs(Iter) = 10*log10(mean(abs(Signal(1,:)).^2)/mean(abs(Signal(1,:)-y(1,:)).^2));
end
figure;
subplot(211);
plot(Iteration,SNRs,'b--','LineWidth',2);
xlabel('Iteration');
ylabel('SNR[dB]')
axis([0,20,0,15]);
subplot(212);
plot(Iteration,SDRs,'b--','LineWidth',2);
xlabel('Iteration');
ylabel('SDR[dB]')
axis([0,20,0,15]);
save fig3.mat SNRs SDRs Iteration
%计算后面的MSE值
save w_mat.mat W
4.操作步骤与仿真结论
????? 我们对tableI的算法进行仿真,同时给出了用于对比的LCMV算法,通过对比,我们得到如下的仿真结果:
图一:LCMV和LC-DANSE的SNR对比仿真图;
图二:LC-DANSE的MSE图(论文中MSE只是DANSE系列的对比,TableI对应其中一种)
图三:LC-DANSE中不同P之的SNR图。
图四:LCMV和LC-DANSE的随着p变化的SNR图。A27-03
|