nlms output problem. if i give the inputs as a). desired AOA = 20 . b). 1st interfer = 40 .c). 2nd interfer = -20 ..output for b) and c) are not coming correctly. please help with my code
1 view (last 30 days)
Show older comments
d = .5;
N=6;
thetaS = input(' What is the desired users AOA (in degrees)? ');
thetaI = input(' What is the 1st interferers AOA(in degrees)? ');
thetaIs = input(' What is the 2nd interferers AOA(in degrees)? ');
T=1E-3;
t=(1:100)*T/100;
it=1:100;
S=cos(2*pi*t/T);
thetaS = thetaS*pi/180;
I = randn(1,100);
thetaI = thetaI*pi/180;
Is = randn(1,100);
thetaIs = thetaIs*pi/180;
vS = []; vI = []; vIs = [];
i=1:N;
vS=exp(1j*(i-1)*2*pi*d*sin(thetaS)).';
vI=exp(1j*(i-1)*2*pi*d*sin(thetaI)).';
vIs=exp(1j*(i-1)*2*pi*d*sin(thetaIs)).';
w = zeros(N,1); snr = 10;
X=(vS+vI+vIs);
Rx=X*X';
mu=1/(4*real(trace(Rx)))
wi=zeros(N,max(it));
for n = 1:length(S)
x = S(n)*vS + I(n)*vI + Is(n)*vIs;
y=w'*x;
e = conj(S(n)) - y; esave(n) = abs(e)^2;
w = w + mu/(0.001+x'*x) * x.* conj(e) ;
wi(:,n)=w;
yy(n)=y;
end
w = (w./w(1)); % normalize results to first weight
theta = -pi/2:.01:pi/2;
AF_3 = zeros(1,length(theta));
for i = 1:N
AF_3 = AF_3 + w(i)'.*exp(1j*(i-1)*2*pi*d*sin(theta));
end
figure
hold on
xlabel('AOA (deg)')
ylabel('|AF_n|')
plot(theta*180/pi,abs(AF_3)/max(abs(AF_3)),'b')
axis([-90 90 0 1.1])
set(gca,'xtick',[-90 -60 -30 0 30 60 90])
legend('NLMS')
grid on
0 Comments
Answers (0)
See Also
Categories
Find more on Octave in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!