%单频信号源、单频干扰,阵元间距离为信号源波长的一半
clc;
close all;
clear all;
M=8;%八个阵元均匀线阵
N=1000;%快拍数
t=1:N;
f0=2e7;%单频信号源的频率
f1=2e5;%单频干扰的频率
Ts=1/(5e9);
s=exp(j*2*pi*f0*t*Ts);%单频信号源
plot(t,s);
xlabel('快拍数');
ylabel('期望信号');
legend('期望信号波形');
grid on;
snr=10;%信噪比
linear_snr=10^(snr/10);%线性信噪比
power_s=0;
for t=1:N
power_s=power_s+(s(t))^2;
end
power_s=power_s/N;%信号功率
power_n=power_s/linear_snr;%噪声功率
t=1:N;
n=exp(j*2*pi*f0*t*Ts+pi/4);%单频干扰
theta_s=40*pi/180;%信号源到达方向
theta_n=10*pi/180;%单频干扰到达方向
a_theta_s=[];
for m=1:M
a_s=exp(-j*(m-1)*pi*sin(theta_s));
a_theta_s=[a_theta_s;a_s];%单频信号源的方向向量
end
a_theta_n=[];
for m=1:M
a_n=exp(-j*(m-1)*pi*sin(theta_n));
a_theta_n=[a_theta_n;a_n];%单频干扰的方向向量
end
noise=normrnd(0,sqrt(power_n/2),M,N)+j*normrnd(0,sqrt(power_n/2),M,N);
%noise=wgn(M,N,0.02);%噪声
X0=[];
for t=1:N
x=s(t)*a_theta_s+n(t)*a_theta_n+noise(:,t); %阵列对信号的完整响应,x为M*1
X0=[X0;x'];%X0为N*M
end
Rxx=zeros(M,M);
for t=1:N
Rxx=Rxx+(X0(t,:))'*X0(t,:);
end
Rxx=Rxx/N;
L=1.0e-6;%步长因子
d=s;
y=zeros(1,N);
[w1,MSE]=lms_beamform(M,N,X0',L,d,y,500);
l=1:500;
figure;
subplot(1,2,1);
plot(l,MSE,'-.m');
xlabel('迭代次数');
ylabel('均方误差');
legend('L=1.0e-6');
L=5.0e-6;%步长因子
d=s;
y=zeros(1,N);
[w2,MSE]=lms_beamform(M,N,X0',L,d,y,500);
l=1:500;
subplot(1,2,2);
plot(l,MSE,'-.m');
xlabel('迭代次数');
ylabel('均方误差');
legend('L=5.0e-6');
%**************************波束图*******************************%
v=1;
for sita=-100:0.1:100
for i=1:M
a(i,1)=exp(-j*(i-1)*pi*sin(pi*sita/180));
end
n(1,v)=abs(w1'*a);%天线增益
v=v+1;
end
n1=10*log10(n/max(n));
sita=-100:0.1:100;
figure;
plot(sita,n1,'-.m');%对纵坐标进行归一化
grid on;
xlabel('角度');
ylabel('幅度dB');
legend('LMS算法:L=1.0e-6');
%**************************波束图*******************************%
v=1;
for sita=-100:0.1:100
for i=1:M
a(i,1)=exp(-j*(i-1)*pi*sin(pi*sita/180));
end
n(1,v)=abs(w2'*a);%天线增益
v=v+1;
end
n1=10*log10(n/max(n));
sita=-100:0.1:100;
figure;
plot(sita,n1,'-.m');%对纵坐标进行归一化
grid on;
xlabel('角度');
ylabel('幅度dB');
legend('LMS算法:L=5.0e-6');
评论1