Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
nlms output graphs not coming correctly. what is the problem in the code ?? given inputs a). 20 b). 40 c). -20
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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; % desired user AOA
I = randn(1,100);
thetaI = thetaI*pi/180; % interferer AOA
Is = randn(1,100);
thetaIs = thetaIs*pi/180; % interferer AOA
a = 0.001;
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; % signal to noise ratio
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.';
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;
plot(it,S,'k',it,yy,'k--')
xlabel('No. of Iterations')
ylabel('Signals')
legend('Desired signal','Array output')
title('NLMS');
disp('%------------------------------------------------------------------------%')
disp(' ')
disp([' The weights for the N = ',num2str(N),' ULA are:'])
disp(' ')
for m = 1:length(w)
disp([' w',num2str(m),' = ',num2str(w(m))])
end
disp(' ')
figure;plot(it,abs(wi(1,:)),'kx',it,abs(wi(2,:)),'ko',it,abs(wi(3,:)),'ks',it,abs(wi(4,:)),'k+',it,abs(wi(5,:)),'kd','markersize',2)
xlabel('Iteration no.')
ylabel('|weights|')
title('NLMS');
figure;
plot(it,esave,'k')
xlabel('Iteration no.')
ylabel('Mean square error')
title('NLMS');
%---------------------------------------------------------------------%
0 commentaires
Réponses (0)
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!