均匀线阵方向图 (1)matlab 程序 clc; clear all; close all; imag=sqrt(-1); element_num=32;%阵元数为8 d_lamda=1/2;%阵元间距d与波长lamda的关系 theta=linspace(-pi/2,pi/2,200); theta0=0;%来波方向 w=exp(imag*2*pi*d_lamda*sin(theta0)*[0:element_num-1]'); for j=1:length(theta) a=exp(imag*2*pi*d_lamda*sin(theta(j))*[0:element_num-1]'); p(j)=w'*a; end patternmag=abs(p); patternmagnorm=patternmag/max(max(patternmag)); patterndB=20*log10(patternmag); patterndBnorm=20*log10(patternmagnorm); figure(1) plot(theta*180/pi,patternmag); grid on; xlabel('theta/radian') ylabel('amplitude/dB') title([num2str(element_num) ' 阵元均 匀 线 阵方 向 图 ',' 来 波 方 向 为' num2str(theta0*180/pi) '度']); hold on; figure(2) plot(theta,patterndBnorm,'r'); grid on; xlabel('theta/rad