mamta arora
Newbie level 1
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]);
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]);