DSPRelated.com
Forums

plotting time domain signal for LMS

Started by shamma December 9, 2007
hi 


My LMS algorithm is working perfectly when i plot constellation but it
doesnot work when i plot the time domain signal,it gives me a constant
zero signal  on the output can anyone tell me where i am wrong here is my
matlab code

Nb=2048
temp=rand(1,Nb);
for i=1:Nb
if(temp(i)>0.5)
    a(1,i)=1;
else
    a(1,i)=-1;
end
end

M1=5; M2=5;
N2=12;
Md=N2-M2;
ph=pi-pi/8;
gc=.707*exp(ph);
nc=-M1:M2;
beta=0.35;
noff=nc-0.5;
npi=noff*pi;
ndenom=1-(2*beta*noff).^2;
q=gc*(sin(npi)./npi).*(cos(beta*npi)./ndenom);
q(1,M1+1)=q(1,M1+1)+1;



x= conv(a,q);
x=x+0.1*(randn(size(x)));

hlms=[zeros(5,1) ; 1; zeros(12,1)];


mu=0.01                                                              
(2*trace(Rxx));

for n=13:2048;
%LMS adaptation
in=x(1,n+5:-1:n-12);
y(n-12)=in*conj(hlms);
errlms(n)=a(1,n-12)-y(n-12);
hlmsold=hlms;
hlms=hlmsold+mu*(errlms(n))*in.';
ylms2(n-12)=dec(y(n-12));   
end


plot(real(a(1,1:2000)),imag(a(1,1:2000)),'b+','MarkerSize',18,'Linewidth',3);
axis([-2 2 -2 2]);
legend('Orignal  Bit Values');
title('Orignal Signal Constellation');
pause


plot(real(x(1,1:2000)),imag(x(1,1:2000)),'b+','MarkerSize',18,'Linewidth',3);
axis([-2 2 -2 2]);
legend('Distored Bit Values');
title('Received Signal Constellation');
pause

plot(real(y(1,1:2000)),imag(y(1,1:2000)),'b+','MarkerSize',18,'Linewidth',3);
axis([-2 2 -2 2]);
legend('LMS Estimate');
title('LMS Estimated Signal Constellation');


it works correctly but when i plot the time domain signal it gives me a 0
on the output for Y


Regards