conv_encoder.m
来自「The result is an IS-95CDMA forward link 」· M 代码 · 共 35 行
M
35 行
function conv=Conv_Encoder(info)
%This is the Convolution Encoder. We pass our data (192 bit, a 20ms frame)into the Convolution Encoder R=1/2, k=9 R=input bits/output bits. K=9 means 9 stage shift register is used
%There is two generator sequences g0(752 octal),g1(561 octal)
%g0=[111101011];%753octal
%g1=[101110001];%561octal
%we reset our9 shift registers to reset state, all `0`s
shifts=zeros([1,9]);
convo=zeros([1,384]);
for i=1:length(info)
%each stage of shift register gets the value from the previous one,except the first
shifts(2:9)=shifts(1:8);
%the next data bit comes into the first shift register
shifts(1)=info(i);
%calculate the first code bit using g0
outa=mod((shifts(1)+shifts(2)+shifts(3)+shifts(4)+shifts(6)+shifts(8)+shifts(9)),2);
outb=mod((shifts(1)+shifts(3)+shifts(4)+shifts(5)+shifts(9)),2);
convo((i*2)-1)=outa;
convo(i*2)=outb;
end
conv=convo;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?