⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weiter1.m

📁 在matlab下输入guide命令后打开main_main.gig 实现卷积编码
💻 M
字号:
u=[1 0 1 0]   %信源码
c=[1     1     1     0     0     0     1     0];%卷积编码结果
y=[1     1     1     0     0     0     1     0],%信道传输后接收端的码元


L=2;%表示第几步
PM1=[0 0 0 0]; %路径存储器00 00 00 00表示最上面的一条路径
temp1=y(1:2*L);temp2=XOR(temp1,PM1);temp3=find(temp2==1);MM1=length(temp3);

PM2=[0 0 1 1];
temp1=y(1:2*L);temp2=XOR(temp1,PM2);temp3=find(temp2==1);MM2=length(temp3);

PM3=[1 1 1 0];
temp1=y(1:2*L);temp2=XOR(temp1,PM3);temp3=find(temp2==1);MM3=length(temp3);

PM4=[1 1 0 1];
temp1=y(1:2*L);temp2=XOR(temp1,PM4);temp3=find(temp2==1);MM4=length(temp3);

for L = 3:4,
    PM1_1=[PM1,0,0];
    PM1_2=[PM3,1,1];
    temp1=y(1:2*L);
    temp2=XOR(temp1,PM1_1);temp3=find(temp2==1);MM1_1=length(temp3);
    temp2=XOR(temp1,PM1_2);temp3=find(temp2==1);MM1_2=length(temp3);
    
    
    
    PM2_1=[PM1,1,1]; %PM2_1表示到达状态b的第一条路径
    PM2_2=[PM3,0,0];
    temp1=y(1:2*L);
    temp2=XOR(temp1,PM2_1);temp3=find(temp2==1);MM2_1=length(temp3);
    temp2=XOR(temp1,PM2_2);temp3=find(temp2==1);MM2_2=length(temp3);
    
    
    PM3_1=[PM2,1,0],
    PM3_2=[PM4,0,1],
    temp1=y(1:2*L),
    temp2=XOR(temp1,PM3_1),temp3=find(temp2==1),MM3_1=length(temp3),
    temp2=XOR(temp1,PM3_2),temp3=find(temp2==1),MM3_2=length(temp3),
    
    
    PM4_1=[PM2,0,1],
    PM4_2=[PM4,1,0],
    temp1=y(1:2*L),
    temp2=XOR(temp1,PM4_1),temp3=find(temp2==1),MM4_1=length(temp3),
    temp2=XOR(temp1,PM4_2),temp3=find(temp2==1),MM4_2=length(temp3),
    
    
    if MM1_1<=MM1_2,
        MM1=MM1_1,PM1=PM1_1,
    else
        MM1=MM1_2,PM1=PM1_2,
    end
    
    if MM2_1<=MM2_2,
        MM2=MM2_1,PM2=PM2_1,
    else
        MM2=MM2_2,PM2=PM2_2,
    end
    
    if MM3_1<=MM3_2,
        MM3=MM3_1,PM3=PM3_1,
    else
        MM3=MM3_2,PM3=PM3_2,
    end
    
    
    if MM4_1<=MM4_2,
        MM4=MM4_1,PM4=PM4_1,
    else
        MM4=MM4_2,PM4=PM4_2,
    end
end


MM=MM1,PM=PM1,
if MM>=MM2,
    MM=MM2,PM=PM2,
end
if MM>=MM3,
    MM=MM3,PM=PM3,
end
if MM>=MM4,
    MM=MM4,PM=PM4,
end
MM=MM,PM=PM


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -