📄 detection_aic.m
字号:
% Mainprogram - AIC(Akaike Information Criterion) for detection of multi-targets
%
% Input parameters:
% M - the number of sensors
% N - the number of snapshots
% X - the array output matrix ( (sensor number) × snapshots, complex )
% D - the eigenvalue vector
% Output parameter:
%
% number - the estimated number of signal sources
% Edited at 20080428 by lf
function number=detection_AIC
clear all
M=14;N=200;Num=2;f0=30000;fs=120000;C=1500;lamda=C/f0;d=lamda/2;
SNR=-5;theta=[-3 3];
X=nbsignal(M,N,Num,f0,fs,lamda,d,theta,SNR);%Generating array signals X(M,N)
char=repmat('%f',1,1);char=[char,',\n'];
fp=fopen('arraysignal.txt','a');%将X保存在arraysignal.txt中
for t=1:N
for m=1:M
fprintf(fp,char,real(X(m,t)));
fprintf(fp,char,imag(X(m,t)));
end
end
fclose(fp);
R=X*X'/N;
d1=eig(R);
d2=sort(d1);% 强制特征值升序排列
D=[d2([M:-1:1])];
[AIC,number]=AIC_method(D,M,N);
figure(1);plot(1,1);plot(0:M-1,AIC,'k');grid on;
title('AIC(Akaike Information Criterion)');xlabel('k');ylabel('AIC');
% Mainprogram end
%-------------------- AIC算法子函数 -------------------%
function [AIC,number]=AIC_method(D,M,N)
AIC=zeros(1,M);
for k=0:M-1
s1=0;
s2=1;
for i=k+1:M
s1=s1+D(i)/(M-k);
s2=s2*D(i)^(1/(M-k));
end
LH=(M-k)*N*log10(s2/s1);
AIC(k+1)=-2*LH+2*k*(2*M-k);
end
number=1;
min=AIC(1);
for j=1:M
if AIC(j) < min
min=AIC(j);
number=j;
end
end
number=number-1;
return
%------------------- 产生阵列信号 -------------------%
function X=nbsignal(M,N,Num,f0,fs,lamda,d,theta,SNR)
%
% Input parameters:
% M - the number of sensors
% N - the number of snapshots
% Num - the number of signals
% f0 - the center frequency of narrow band sources ( Unit: Hz )
% fs - the sample frequency ( Unit: Hz )
% lambda - wavelength of the signals(Unit: meter)
% d - the distance between two sensors(Unit: meter)
% theta - the source angle vector (1xp), e.g. [30 40 50] means there
% are three sources located in 30,40,50 degree respectively.
% SNR - the signal-to-noise ratio of the power of each source to the
% power of noise at single sensor (dB).
%
% Output parameter:
%
% X - the array output matrix ( M x N, complex )
A=exp(j*2*pi*d/lamda*[0:(M-1)]'*sin(theta*pi/180));
S=exp(j*2*pi*[f0-500 f0+500]'*[1:N]/fs);
X=A*S;
varc=1/sqrt(2*10^(SNR/10));
X=X+varc*(randn(size(X))+j*randn(size(X)));
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -