sa_ex7_10.m

来自「这个是英文版<<Smart Antennas for Wireles」· M 代码 · 共 49 行

M
49
字号
% Min-Norm AOA estimation for a M = 6 element array with noise variance = .1

tic
M=6;
D = 2;  % number of signals
sig2=.1;
th1=-5*pi/180;
th2=5*pi/180;
a1=[1];
a2=[1];
a=[1];
F=[1;1];
temp=eye(M);
%temp=zeros(1,M-1);

%u1=[1 temp];
u1=temp(:,1);
u3=temp(:,3);
for i=2:M
    a1=[a1 exp(-1j*i*pi*sin(th1))];
    a2=[a2 exp(-1j*i*pi*sin(th2))];
end
A=[a1.' a2.'];     % transpose without conjugating
Rss=[1 0;0 1];
Rrr=A*Rss*A'+sig2*eye(M);
%Rrr=(A*F+sig2*diag(eye(M)))*(A*F+sig2*diag(eye(M)))';
[V,Dia]=eig(Rrr);
[Y,Index]=sort(diag(Dia));   % sorts the eigenvalues from least to greatest
 EN=V(:,Index(1:M-D));      % calculate the noise subspace matrix of eigenvectors
                           % using the sorting done in the previous line
for k=1:360;
   th(k)=-pi/6+pi*k/(3*360);
   clear a
a=[1];
   for jj=2:M
      a = [a exp(-1j*jj*pi*sin(th(k)))];
   end
P(k)=1./abs(conj(a)*EN*EN'*u1).^2; 
%P(k)=1./abs(conj(a)*EN*EN'*u3).^2; 
P2(k)=1./abs(sum(conj(a)*EN)).^2;
end
figure;
plot(th*180/pi,10*log10(P/max(P)),'k')
grid on
xlabel('Angle')
ylabel('|P(\theta)|')
axis([-30 30 -30 10])
toc
%num2str(A,2)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?