%解码AF、检测DF、放大与转发的比较
%带AWGN的平坦衰落中的BPSK:
%绘制了误码率的仿真结果和理论结果。
%使用MRC组合两个信号
%使用平均误码率
sum_dcf = 0;
sum_dtf = 0;
sum_af = 0;
%%%%%%%%%%%%%%%%%%%User1:Source%%%%%%%%%%%%%%
N_bits = 15000; %Number of data bits
%number of iterations over which the results are going to be averaged
N_iter = 15;
for iter = 1:N_iter
data = round(rand(N_bits,1));%random data bits
%channel coding using rate 1/2 convolutional code:
trellis = poly2trellis(3,[5 7]); %trellis structure
c_data = convenc(data,trellis);