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

📄 pr9_27.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem 9.27;
%convolutional encoding/decoding using Communication Toolbox;

G=[47,53,75]; %1 by n matrix of generator polynomials in octal form;
Gb=de2bi(oct2dec(G'),'left-msb'); %conversion octal-number representation of generation polynomial to binary vectors;
[i,j]=find(Gb); nzcl=min(j); Gb=Gb(:,nzcl:end); %removal of left zero-padding;
nu=size(Gb,2); %constraint length;
n=size(G,2); %frame length;
L=10*nu*n; %length of the block to decode;
Tr=poly2trellis(nu,G); %creating trellis;
we=18; %weight of error vector;
Sm=0; %initialize bit error counting;
N=1000; %number of trials;
trback=5*nu; %depth of tracing back before releasing bit;
for k=1:N
    e=randerr(1,L,we); %error vector;
    ud=vitdec(e,Tr,trback,'term','hard'); %decoding;
    er=sum(ud); %number of errors;
    Sm=Sm+er; %accumulated numbrer of bit errors;
end;
BER=Sm/(N*10*nu)+eps; %BER, eps is added to make a convenient output format;
fprintf('\n'); disp('generator polynomials'); disp(num2str(G')); fprintf('\n');
fprintf('\n'); disp('   cnstlg    trback    erweight    BER'); 
fprintf('\n'); disp([nu,trback,we,BER]);fprintf('\n');

⌨️ 快捷键说明

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