📄 sa_ex8_7.m
字号:
%%%%%%%%%%%%%%%%%%%
%% SMI Algorithm example 8.7%%
%%%%%%%%%%%%%%%%%%%
%----- Givens -----%
K=100; % Block length
sig2=.001;
d = .5; % element spacing in terms of wavelength d = lambda/2
N = input(' How many element do you want in uniform linear array? '); % number of elements in array
thetaS = input(' What is the desired users AOA (in degrees)? ');
thetaI = input(' What is the interferers AOA(in degrees)? ');
%----- Desired Signal & Interferer -----%
T=1E-3;
t=(1:K)*T/K;
S=cos(2*pi*t/T);
thetaS = thetaS*pi/180; % desired user AOA
randn('state',5)
I = randn(1,K);
thetaI = thetaI*pi/180; % interferer AOA
n=randn(N,K)*sqrt(sig2); % calculate noise in each array input
%----- Create Array Factors for each user's signal for linear array -----%
vS = []; vI = [];
i=1:N;
vS=exp(1j*(i-1)*2*pi*d*sin(thetaS));
vI=exp(1j*(i-1)*2*pi*d*sin(thetaI));
%----- Solve for Weights using SMI -----%
x=(vS.'*S+vI.'*I+n);
Rxx=x*x'/K;
r=x*S'/K;
w=inv(Rxx)*r;
w = conj(w./w(1)); % normalize results to first weight
w.'
%----- Plot Results -----%
theta = -pi/2:.01:pi/2;
AF = zeros(1,length(theta));
% Determine the array factor for linear array
e=S(K)-w.'*sum(x,2)/K
for i = 1:N
AF = AF + w(i).*exp(j*(i-1)*2*pi*d*sin(theta));
end
figure;
plot(theta*180/pi,abs(AF)/max(abs(AF)),'k')
xlabel('AOA (deg)')
ylabel('|AF_n|')
axis([-90 90 0 1.1])
set(gca,'xtick',[-90 -60 -30 0 30 60 90])
grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -