64,676
社区成员
发帖
与我相关
我的任务
分享
clc
close all
clear all
%参数设置
lambda=0.1;
k=2*pi/lambda;
dz=lambda/2;
dy=lambda/2;
M=[5,0];
N=[8,0];%%%%%%%%修改
theta=linspace(-90,90,181)*pi/180;
phi=linspace(-90,90,181)*pi/180;
%波束指向
theta_0=60;
phi_0=20;
theta_d=theta_0*pi/180;
phi_d=phi_0*pi/180;
alpha=k*dy*cos(theta_d)*sin(phi_d);
beta=k*dz*sin(theta_d);
%方向图计算
for u=1:length(theta)
for v=1:length(phi)
for n=1:N(1,1)
for m=1:M(1,1)
a1(m)=exp(1i*(n-1)*(k*dy*cos(theta(u))*sin(phi(v))-alpha));
a2(m)=exp(1i*(m-1)*(k*dz*sin(theta(u))-beta));
a(m)=a1(m)*a2(m);
end
b(n)=sum(a);
end
p(u,v)=sum(b);
end
end
P=20*log10(abs(p)/abs(max(max(p))));
%绘图
mesh(P);
xlabel('方位角/Phi');
ylabel('俯仰角/Theta');
title('均匀面阵三维方向图');
figure
f=P(theta_0+90+1,:);
subplot(2,2,1)
plot(phi*180/pi,f);
ylim([-50,0]);