%用MATLAB做卷积码仿真,看哪些函数?
%convc和vetdec
clear all;
snr=6;%信噪比是6dB
t= poly2trellis(7,[171 133]);
%Convert convolutional code polynomials to trellis description
K = log2(t.numInputSymbols); % Number of input bit streams
N = log2(t.numOutputSymbols); % Number of output bit streams
numSymPerFrame = 1000; % Number of symbols per frame
msg=randi([0 1],K*numSymPerFrame,1);
code= convenc(msg,t);
ncode=awgn(code,snr,'measured',244);
qcode=quantiz(ncode,[0.001,0.1,0.3,0.5,0.7,0.9,0.999]);%量化以进行软判决
tblen=48;%回溯的深度
delay=tblen;
decoded=vitdec(qcode,t,tblen,'cont','soft',3);
[number,ratio]=biterr( decoded(delay+1:end), msg(1:end-delay) );