www.pudn.com > DBF_oneANDtwo.zip > dbf.m, change:2015-06-14,size:708b


function [deg,result]=dbf(M,N,xishu) 
ratio=1; 
if xishu==1 
    ratio=N; 
end 
 
a=zeros(1,M); 
delta=2*pi*sin(pi/3.6)*ratio/2;%阵元间距最短为半波长 
for m=1:M 
    a(1,m)=exp(-1j*(m-1)*delta); 
end 
 
deltb=2*pi*sin(pi/3.6)/2; 
b=zeros(1,N); 
for n=1:N 
    b(1,n)=exp(-1j*(n-1)*deltb); 
end 
ab=kron(a,b); 
 
deltfi=-pi/3:pi/300:pi/3; 
afi=zeros(length(deltfi),M*N); 
fi=zeros(1,N); 
for q=1:length(deltfi) 
 
    for n=1:M 
        a(1,n)=exp(-1j*(n-1)*2*pi*sin(deltfi(q))*ratio/2); 
    end 
     
    for n=1:N 
        fi(1,n)=exp(-1j*(n-1)*2*pi*sin(deltfi(q))/2); 
    end 
    afi(q,:)=kron(a,fi); 
end 
 
result=ab*afi'; 
result=result/max(result); 
result=20*log10(result); 
deg=deltfi*180/pi;