close
all
;
clear
all
;
N=1024;
L=128;
SNR=15;
Symbol_num=6;
Bit_sym=4;
s=randint(1,N*Symbol_num*Bit_sym);
s_map=qammod(2.^(Bit_sym-1:-1:0)*
reshape
(s,Bit_sym,N*Symbol_num),16);
t=
ifft
(
reshape
(s_map,N,Symbol_num))*N;
t_add_CP=[t(N-L+1:N,:);t];
SNR_line=10^(SNR/10);
transmit=
reshape
(t_add_CP,1,(N+L)*Symbol_num);
sigmma=(1^2+3^2)/2/SNR_line;
Noise=(
randn
(1,(N+L)*Symbol_num)+
j
*
randn
(1,(N+L)*Symbol_num))*
sqrt
(sigmma/2);
recieve=
zeros
(1,Symbol_num*(N+L));
erro_rate=
zeros
(1,10);
index=1;
for
e=0.02:0.01:0.12;
for
i
=1:Symbol_num;
k=1:N+L;
recieve((
i
-1)*(N+L)+1:(N+L)*
i
)=transmit((
i
-1)*(N+L)+1:(N+L)*
i
).*
exp
(
j
*2*
pi
*e*k/N);
end
r=
reshape
(recieve+Noise,N+L,Symbol_num);
r1=
reshape
(
fft
(r(L+1:
end
,:))/N,1,N*Symbol_num);
Out_symbol=qamdemod(r1,16);
Out_bit=
zeros
(4,N*Symbol_num);
for
i
=1:N*Symbol_num;
for
k=1:Bit_sym
Out_bit(k,
i
)=
floor
(Out_symbol(
i
)/(2^(Bit_sym-k)));
if
Out_bit(k,
i
)==1
Out_symbol(
i
)=Out_symbol(
i
)-2^(Bit_sym-k);
else
end
end
end
Out_bit=
reshape
(Out_bit,1,Bit_sym*N*Symbol_num);
erro_rate(index)=
length
(
find
(Out_bit~=s))/
length
(s);
index=index+1;
end
semilogy
(0.02:0.01:0.12,erro_rate,
'-*'
)
axis
([0.01 0.12 10^(-5) 1])