matlab code for 16 qam - problem

Status
Not open for further replies.

mamta arora

Newbie level 1
Joined
Mar 10, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
hello friends,
can anybody help me plz , this is code for 16 qam , but i got straight line as output instead of as waterfall plzzzzz help me friends...








n1=10^6;
M=16;
k=log2(M);
ebnodb = -5:2:20;
data = randint (1,n1);
simBER_awgn=zeros(1,length(ebnodb));
trellis = poly2trellis(7,[171 133]);
codedata= convenc(data,trellis);
m=reshape(codedata,length(codedata)/k,k);
xsym = bi2de(m,'left-msb');
y=qammod(xsym,M);
for i=1:length(ebnodb)
noise=1/sqrt(2)*(randn(size)+1i*randn(size));
n = noise*10^(-ebnodb(i)/20);

y_awgn=y+n;

dem_data_awgn = qamdemod(y_awgn,M);

z_awgn= de2bi(dem_data_awgn,'left-msb');
z1_awgn = reshape(z_awgn.',prod(size(z_awgn)),1);
decodedata_awgn = vitdec(z1_awgn,trellis,15,'trunc','hard');

simBER_awgn(i)=sum(xor(data,decodedata_awgn.'));
end

simBER_awgn=simBER_awgn/n1;
semilogy(ebnodb,simBER_awgn,'g*-','LineWidth',2);hold on;
grid on;
axis([-5 20 10^-5 1.2]);
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…