协同通信的MATLAB仿真代码
代码说明:
协同通信的MATLAB仿真代码 g = [ 1 1 1; 1 0 1 ]; x1 = round(rand(1, 112)); % info. bits 信息比特 CRC_CCITT = CRC_16(x1); x =[x1,CRC_CCITT] %加上CRC 比特信息 input = x; output1 = rsc_encode(g,input,1) t = poly2trellis(3,[7 5],7); % Define trellis. code = convenc(x,t)% Encode the data. err = sum(abs(code - output1(1:end-4))) ncode = awgn(code,4,"measured"); % Add noise. opmode = "trunc"; %操作模式 tblen1 = 5; decode1= vitdec(-ncode, t, tblen1, opmode, "unquant"); err1 = sum(abs(decode1 - x)) qcode = quantiz(ncode,[0.001,.1,.3,.5,.7,.9,.999]); add =zeros(1,96); qcode = [qcode,add]; tblen = 48; delay = tblen; % Traceback length decode2 = vitdec(qcode,t,tblen,"cont","soft",3); % Decode. %[number,ratio] = biterr(decode2(delay+1:end),x(1:end-delay)) %err2 = sum(abs(decode2 - x)) [number,ratio] = biterr(decode2(delay+1:end),x(1:end)) err2 = sum(abs(decode2(delay+1:end) - x))
下载说明:请别用迅雷下载,失败请重下,重下不扣分!