www.pudn.com > beam-MUSIC.zip > BEAMFORMING_MUSIC_BS1.m, change:2010-01-03,size:1613b


%BEAMFORMING_MUSIC_BS1 ALOGRITHM 
%DOA ESTIMATION BY BEAMFORMING_MUSIC(BS1) 
clear all; 
close all; 
clc; 
 
source_number=2;%信元数 
sensor_number=8;%阵元数 
B=4;%波束数 
N_x=1024; %信号长度 
snapshot_number=N_x;%快拍数 
w=[pi/4 pi/6]';%信号频率 
l=((2*pi*3e8)/w(1)+(2*pi*3e8)/w(2))/2;%信号波长   
d=0.5*l;%阵元间距 
snr=10;%信噪比 
 
source_doa=[45 60];%两个信号的入射角度 
A=[exp(-j*(0:sensor_number-1)*d*2*pi*sin(source_doa(1)*pi/180)/l);exp(-j*(0:sensor_number-1)*d*2*pi*sin(source_doa(2)*pi/180)/l)].';%阵列流型 
 
s=sqrt(10.^(snr/10))*exp(j*w*[0:N_x-1]);%仿真信号 
%x=awgn(s,snr); 
x=A*s+(1/sqrt(2))*(randn(sensor_number,N_x)+j*randn(sensor_number,N_x));%加了高斯白噪声后的阵列接收信号 
 
%生成变换矩阵T 
T=1/sqrt(sensor_number)*[exp(-j*(0:sensor_number-1)'*pi*sin(2/sensor_number)) exp(-j*(0:sensor_number-1)'*pi*sin(4/sensor_number)) exp(-j*(0:sensor_number-1)'*pi*sin(6/sensor_number)) exp(-j*(0:sensor_number-1)'*pi*sin(8/sensor_number))];                                              
T1=T'*T; 
disp(T1); 
 
%通过波束空间变换后的输出 
y=T'*x; 
 
R=y*y'/N_x; 
 
%[V,D]=eig(R); 
%Un=V(:,1:B-source_number); 
%Gn=Un*Un'; 
[V,D]=eig(R); 
D=diag(D); 
disp(D); 
Un=V(:,1:B-source_number); 
Gn=Un*Un'; 
 
searching_doa=-90:0.1:90;%线阵的搜索范围为-90~90度 
 for i=1:length(searching_doa) 
   a_theta=exp(-j*(0:sensor_number-1)'*2*pi*d*sin(pi*searching_doa(i)/180)/l); 
   Pmusic(i)=1./abs((a_theta)'*T*Gn*T'*a_theta); 
 end 
plot(searching_doa,10*log(Pmusic)); 
%axis([-90 90 -90 90]); 
xlabel('入射角/度'); 
ylabel('谱峰'); 
legend('BEAMFORMING-MUSIC-BS1 Spectrum'); 
title('波束空间MUSIC估计'); 
grid on;