www.pudn.com > Yuan-Zhen.zip > Yuan Zhen.m, change:2013-10-01,size:1163b

```clc
clear   all
close   all
f=350e6;
c=3e8;
lamda=c/f;
beta=2*pi/lamda;
theta0=90/180*pi;              % 方向图指向方位
phi0=00/180*pi;
N=7;
R=zeros(2,N);
r=0.9;%N/2*lamda/(2*pi);
alphi=(0:N-1)*(2*pi/N);
xx=r*cos(alphi);
yy=r*sin(alphi);
R(1,:)=xx;
R(2,:)=yy;

theta=(0:1:180)/180*pi;     % 方位角【0 180】
phi=(0:1:90)/180*pi;        % 仰角【0 90】

k0=[cos(theta0)*cos(phi0) sin(theta0)*cos(phi0)].'; % 指向矢量
for ii=1:length(theta)
for jj=1:length(phi)
k=[cos(theta(ii))*cos(phi(jj)) sin(theta(ii))*cos(phi(jj))].';     % 水平阵
F(ii,jj)=abs(sum(exp(-j*beta*k.'*R).*exp(j*beta*k0.'*R)));
end
end

% =============================================================== %
F_n=20*log10(F);
F_n=F_n-max(max(F_n));
figure;
plot(theta*180/pi,F_n(:,find(phi==phi0)).'),grid on ,
title('水平方向图'),axis([0 180 -40 0])
figure;
plot(phi*180/pi,F_n(find(theta==theta0),:)),grid on ,
title('垂直方向图'),axis([0 90 -40 0])
figure,mesh(theta*180/pi,phi*180/pi,F_n.'),axis([0 180  0 90  -60 0 ])
figure,[C,h]=contour(theta*180/pi,phi*180/pi,F_n.',[-7,-7]);clabel(C,h)```