📄 dbtex927.m
字号:
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% 程序功能:仿真圆形阵列天线的用法 %
% 程序员:王浩 harvey %
% 日期:20071111 %
% 备注:本例演示圆形阵列天线的用法 %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%function dbtex927
%*******************************************%
% 参数定义
%*******************************************%
lambda=1;
%*******************************************%
% 产生天线阵元
%*******************************************%
nElem=8;
elem21=defant('isotropElem'); %各向同性
elem2=cell(1,nElem);
for n=1:nElem,elem2{n}=elem21; end%for n
%*******************************************%
% 产生天线阵列
%*******************************************%
%计算阵元位置
radius=0.5*lambda;
angle=linspace(0,2*pi,nElem+1); %y = linspace(a,b) generates a row vector y of 100 points linearly spaced between and including a and b.
%?产生一个100个元素的行向量,元素的值从a到b均匀分割
angle=angle(1:(length(angle)-1));%P=angle(Z) returns the phase angles, in radians, for each element of complex array Z.The angles lie between +pi and -pi.
xPos=radius*cos(angle);
yPos=radius*sin(angle);
elemPos=[xPos;yPos];
% 画出阵元的位置
plot(elemPos(1,:),elemPos(2,:),'o')
axis('square')
xlabel('x-position')
ylabel('y-position')
title('Element positions')
for n=1:nElem
text(elemPos(1,n),elemPos(2,n),[' ',num2str(n)]) %text(x,y,'string') adds the string in quotes to the location specified by the point (x,y)
end %for n
%产生阵列
ant2=defant('array',elemPos,[],elem2);
%*******************************************%
% 用两种方法画天线方向图
%*******************************************%
smplPoints=linspace(-pi,pi,361);
%画方向图的角度
%画矩形方向图
figure,spantpat3(ant2,{'lambda',lambda,'mainPointDoa',d2r(0),'smplPoints',linspace(-pi,pi,361),'taperType','uniform','taperParam',[1 1 1 1 1 1 1 1].'})
%画极坐标方向图
figure,spantpat3(ant2,{'lambda',lambda,'mainPointDoa',d2r(0),'smplPoints',smplPoints,'taperType','uniform','taperParam',[1 1 1 1 1 1 1 1].','plotType','polar'})
%*******************************************%
% 仿真两个信号
%*******************************************%
theta=d2r([77 100])'; %目标角度,目标数由角度的个数给出
phi =zeros(size(theta)); %目标角度
SNR = [10 10]'; %每个阵元的信噪比dB
alpha =d2r([0 -150])'; %目标信号的开始相位
dalpha =d2r([34 -66])'; %快拍间的相移,表示目标在以常速运动
dist=Inf*ones(size(theta)); %源的距离,Inf指无穷大
sig =compsim4(ant2,lambda,100,'rndnw',[theta,phi,SNR,alpha,dalpha,dist,eye(size(theta,1))],'rndnw',[]);
%产生仿真信号收到的天线信号,具体各参数含义请参考doc compsim4函数说明
%*******************************************%
% 估计并画出方向谱
%*******************************************%
spect1 =sdoaspc('music',sig,smplPoints,3); %用MUSIC估计DOA
spect2 =sdoaspc('cbf',sig,smplPoints); %用传统波束形成估计DOA
figure,splot2(spect1,'',spect2) %画出DOA谱
legend('MUSIC','Conventional beamforming')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -