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

📄 testpunc34.m

📁 卷积码程序很适用的
💻 M
字号:
clear all;
clc;

n=11;
c=[1 1 1 0 0 0 0 0 0 0 0 1];%[c0 c1 c2 ....cr]
err_count  = 0;

for j = 1:10
input=msjgenerator(n,c);%%%伪随机系列产生信号源
err_count1 = 0;
%input=[1 0 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 1 0 0 1 1 0 1 1 0];
%   rand('state',0);
%   input=rand(1,64*10*2*2)>0.5;
  
  
 %g=[1 0 1 1 0 1 1;1 1 1 1 0 0 1 ];
 g=[ 1 1 1;1 0 1];
 k0=1;
 %P=[1 1;1 0];
 P=[1 1 1;1 0 0];
 
output=cnv_encd(g,k0,input);
a=output;
% a(4:4:end)=[]; %2/3
% a(4:6:end)=[];%3/4
% a(5:5:end)=[];

a(4:6:end)=[];%3/4
a(5:5:end)=[];

aa = awgn(a,10,'measured',1234); % Add noise.


a1=-2*a+1;%0映射为1,1映射为-1
a2 = awgn(a1,10,'measured',1234); % Add noise.



%%%%接收判决
for i=1:length(a2)
    if a2(i)>=0
        a3(i)=0;
    else
        a3(i)=1;
    end
end



b=zeros(1,length(output));

%rc=2/3 补0
% b(1:4:end)=a3(1:3:end);
% b(2:4:end)=a3(2:3:end);
% b(3:4:end)=a3(3:3:end);

%rc=3/4 补0
% b(1:6:end)=a3(1:4:end);
% b(2:6:end)=a3(2:4:end);
% b(3:6:end)=a3(3:4:end);
% b(5:6:end)=a3(4:4:end);
b(1:6:end)=a3(1:4:end);
b(2:6:end)=a3(2:4:end);
b(3:6:end)=a3(3:4:end);
b(5:6:end)=a3(4:4:end);
%decoding
[decoder_output1,survivor_state,cumulated_metric]=viterbip34(g,k0,b,P);
err_count1 = sum(xor(decoder_output1,input));
if (err_count1 >0)
    err_count = err_count +1;
end
if (mod(j,10)== 0)
    fprintf('the current frame is %d\n\n',j);
end
end
fprintf('the error number is %d\n\n',err_count);
    
% [num_bit,ratio_bit]=biterr(decoder_output1,input)

⌨️ 快捷键说明

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