7,3循环码

合集下载

第9章 差错控制编码习题解答

第9章 差错控制编码习题解答

1
解:
(1) 检测e个随机错误,则要求d0 ≥ e +1 (2) 纠t个随机错误,则要求d0 ≥ 2t +1 (2) 纠t个,同时检测e个(e > t)随机错误,则要求d0 ≥ t + e +1 由上述公式得 : (5,1)重复码d0 = 5,故能检4位错,纠2位错, 并同时能纠1位错和检3位错.
x11 + x10 + x9 + x6 + x +1
x11 + x10 + x9 + x7 + x3
x7 + x6 + x3 + x +1
得余多项式为x7 + x6 + x3 + x +1
由于余多项式不为0, 故码字在传输过程中有错, 故需要重发.
9-10 设(7,3)线性分组码的监督矩阵为
⎡1 0 1 1 0 0 0 ⎤
接收码字为T (x) = x14 + x5 + x +1
x8 + x7 + x6 + x4 +1 x14 + x5 + x +1
x6 + x5 + x3
x14 + x13 + x12 + x10 + x6
x13 + x12 + x10 + x6 + x5 + x +1
x13 + x12 + x11 + x9 + x5
H
=
⎢⎢1 ⎢1
1 1
1 0
0 0
1 0
0 1

循环码

循环码

实验、循环码编译码系统一、 实验目的:1、熟悉循环码的编译码原理;2、掌握Quartus Ⅱ开发软件的运用,在该软件下熟练的运用多种输入方式完成各种电路设计的要求;3、初步掌握VHDL 语言,能够运用该语言编写简单的程序,完成设计要求;4、熟悉对PLD 的下载和仿真,学会观察测试结果的正确性;5、学会运用各方面知识,设计并实现一个系统。

二、 实验要求:使用Quartus Ⅱ软件,用m 序列发生器作为信号源设计循环码编译码,速率可自定,并在实验箱上调试出编码和译码波形,比较信号源和译码后的信号波形。

三、实验设备:Quartus II 软件、Modelsim 软件、FPGA 实验箱、微机1台、示波器1台四、实验原理:1、 循环码的编码循环码最大的特点就是码字的循环特性,所谓循环特性是指:循环码中任一许用码组经过循环移位后,所得到的码组仍然是许用码组。

若(1n a - 2n a -…… 1a 0a )为一循环码组,则(2n a - 3n a -……0a 1n a -)、(3n a - 4n a -……1n a - 2n a -)、……还是许用码组。

也就是说,不论是左移还是右移,也不论移多少位,仍然是许用的循环码组。

表1-2给出了一种(7,3)循环码的全部码字。

可以将循环码码组用代数多项是来表示,这个多项式被称为码多项式,对于表1-2中的任一码组可以表示为:654326543210()A x a x a x a x a x a x a x a =++++++ (1-4)表1-2一种(7,3)循环码的全部码字在码多项式运算中采用按模运算法则。

若一任意多项式F (x )被一个n 次多项式N (x )除,得到商式Q (x )和一个次数小于n 的余式R (x ),也就是:()()()()()F x R x Q x N x N x =+ (1-5) 则可以写为:F (x )≡R (x )(模N (x ))。

这时,码多项式系数仍按模2运算,即只取值0和1,假设:计算x 4+x 2+1除以x 3+1的值可得:422331111x x x x x x x ++++=+++ (1-6)循环码的生成多项式和生成矩阵:(全0码字除外)称为生成多项式,用g (x )表示。

循环码(7,3)码

循环码(7,3)码

关键字:循环码
编码 译码 检错 纠错 Matlab
信道编码:信道编码又称差错控制编码或纠错编码,它是提高信
息传输可靠性的有效方法之一。 一类一类信道编码是对 传输信号的码型进行变换, 使之更适合于信道特性或满足接收端对恢 复信号的要求,从而减少信息的损失;另一类信道编码是在信息序列 中人为的增加冗余位,使之具有相关特性,在接收端利用相关性进行 检错或纠错,从而达到可靠通信的目的。
以生成多项式 g ( x ) = x + x + x + 1 构造 G ( x) , 相应的矩 阵 形式为
6 5 4 2 ⎡x2g(x) ⎤ ⎡x + x + x + x ⎤ ⎥ ⎢ ⎥ ⎢ G(x) = ⎢x g(x) ⎥ = ⎢x5 + x4 + x3 + x ⎥ ⎢ g(x)⎥ ⎢x4 + x3 + x2 +1 ⎥ ⎣ ⎦ ⎣ ⎦
3号
0100111
0111010 4号
0011101 2号
1001110 5号
图1.1-1(7,3)循环码中的循环圈
可见除全零码组外,不论循环右移或左移,移多少位,其结果均 在该循环码组的集合中(全零码组自己构成独立的循环圈) 。
《信息论与编码》课程设计报告 -4-
1.1.3、码多项式
为了用代数理论研究循环码,可将码组用多项式表示,循环码 组中 各 码 元 分 别 为 多 项 式 的 系 数 。 长 度 为
力系统地构造这类码, 且易于实现, 所以循环码受到人们的高度重视 , 在 FEC 系统中得到了广泛应用。
1.1.1、循环码定义
定义:一个线性分组码,若具有下列特性,则称为循环码。设码字

7,3循环码.

7,3循环码.

******************实践教学*******************兰州理工大学计算机与通信学院2014年秋季学期计算机通信课程设计题目:(7,3)循环码编译码软件设计专业班级:姓名:学号:指导教师:成绩:摘要随着计算机通信的日益发展,传输数据的场合越来越多。

串行数据的差错检验是保证数据传输正确的必要手段,而循环码是差错码中最常用的一种编码。

循环码是线性分组码中最重要的一种子类,它除了具有分组码的线性外,还具有循环性,其码字结构一般用符号(n,k)表示,其中,n是该码组中的码元数,k是信息码元位数,r=n-k是监督码元位数。

循环码具有许多特殊的代数性质,这些性质有助于按照要求的纠错能力系统地构造这类码,能简化译码算法,并且目前发现的大部分线性码与循环码有密切关系。

已有循环码编译码系统大多以标准逻辑器件(如中小规模TTL系列、CMOS系列)按传统数字系统设计方法设计而成,其主要缺点是逻辑规模小、功耗大、可靠性低。

随着大规模、超大规模集成电路的发展,以及电子设计自动化水平的提高,这种制约正在被逐渐消除。

本文通过C 语言平台运行所编写的程序,观察了在输入信息码情况下输出对应的编码结果以及相反的译码功能。

通过多组的对比验证了该(7,4)循环码的编译码程序的正确性。

最后,在程序运行的过程中进步分析循环码的编译码原理,并通过比较仿真模型与理论计算的性能,证明了仿真模型的可行性。

关键词:循环码;编码;译码;程序仿真目录前言 (1)1、目的及意义 (2)2、设计原理 (3)2.1循环码的介绍 (3)2.1.1循环码的定义 (3)2.1.2循环码的特点 (3)2.1.3循环码的多项式表示 (4)2.1.4(n,k)循环码的生成多项式 (4)2.1.5循环码的生成矩阵和一致校验矩阵 (6)2.2循环码编码原理 (8)2.2.1多项式除法电路 (8)2.3循环码译码原理 (9)3、设计结果及分析 (11)3.1程序运行结果 (11)3.2运行结果理论分析 (14)3.3软件可行性分析 (15)4、总结 (16)附录 (17)参考文献 (22)前言数字信号在传输过程中,由于受到干扰的影响,码元波形将变坏。

循环码

循环码

8.5 循环码循环码是线性分组码中最重要的一个子类码,它的基本特点是编码电路及伴随式解码电路简单易行;循环码代数结构具有很多有用的特性,便于找到有效解码方法。

因此在实际差错控制系统中所使用的线性分组码,几乎都是循环码。

下面将介绍循环码的多项式表示及其性质,同时简介几种重要的循环码,CRC、BCH和R-S 码等。

8.5.1 循环码的描述1. 码多项式及其运算通式表示为:(8-69)于是称与为“同余”式,即[模](8-70)如:则[模] 即能被整除利用这一运算原理,我们可对一个码字进行移位表示:如:的多项式表示为:使码组向左移2位(循环)则有对应多项式然后以去除得:这一结果表明,以作除法运算(称模)后,即与为同余因此,(模)应注意,利用这种同余式表示,必须加注(模),否则就不明确在什么条件下得到的这一同余关系式。

2.循环码的构成循环码的构成突出特点是只要是该码中的一个许用码组——码字,通过循环位其结果则可包括全部个非全0码字,如上面介绍的(7,3)分组码,从信码位0 0 1构成的码字(0011101)开始逐一向左(或者向右)移一位,可得其余6个码字:(0111010)、(1110100)、(1101001)、(1010011)、(0100111)、(1001110)。

若把这些码字写成码多项式,都具有同一个移位运算模式,并设(0011101)对应的码多项式,于是,有:(模)(8-71)这样,就构成了(7,3)循环码,如表8-4。

从表8-4看出,循环得到的(7,3)码,仍为系统码,信息码组均在表中码字的高位(左方)。

表8-4 (7,3)循环码移位(7,3)码码多项式(模)0 0 0 1 1 1 0 11 0 1 1 1 0 1 02 1 1 1 0 1 0 03 1 1 0 1 0 0 14 1 0 1 0 0 1 15 0 1 0 0 1 1 16 1 0 0 1 1 1 08.5.2 循环码生成多项式与生成矩阵1. 生成多项式由表8-4构成个非全0码字多项式的过程与结果看,我们从开始进行逐一循环,并以模运算,该码字正是信码组中最低位为1,对应码字多项式,在全部非全0码字中,它的最高位阶次也最低,并等于,即最高次项为,随后一系列码字都源于它的移位而形成,因此称其为生成多项式,即(8-72)然后再从的因式分解来进一步分析(8-73)我们可以将三个既约多项式因式任意组合成两个因式,可有(8-74)如:(8-75)(8-76)其中可以组合为二因式中包含最高次为4次的情况有两种,即展开式的第4及第5两组,都可以作为阶次最高为4的即(8-77)(8-78)在展开式中选用了其中一个(组合)因式为后,余下一个因式,则称其为循环码的监督多项式,如式(8-74)生成多项式与相应监督多项式乘积等于多项式。

信息论(7,4)汉明码(7,3)循环码

信息论(7,4)汉明码(7,3)循环码

functionvarargout = Hamming(varargin)% HAMMING M-file for Hamming.fig% HAMMING, by itself, creates a new HAMMING or raises the existing % singleton*.%% H = HAMMING returns the handle to a new HAMMING or the handle to % the existing singleton*.%% HAMMING('CALLBACK',hObject,eventData,handles,...) calls thelocal% function named CALLBACK in HAMMING.M with the given input arguments. %% HAMMING('Property','Value',...) creates a new HAMMING or raises the % existing singleton*. Starting from the left, property value pairs are% applied to the GUI before Hamming_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application% stop. All inputs are passed to Hamming_OpeningFcn via varargin. %% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help Hamming% Last Modified by GUIDE v2.5 07-Jan-2008 20:22:48% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @Hamming_OpeningFcn, ...'gui_OutputFcn', @Hamming_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);ifnargin&&ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});endifnargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before Hamming is made visible.functionHamming_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to Hamming (see VARARGIN)% Choose default command line output for Hamminghandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes Hamming wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line. functionvarargout = Hamming_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;function edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text% str2double(get(hObject,'String')) returns contents of edit1 as a double% --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit2 as text% str2double(get(hObject,'String')) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit3 as text% str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties. function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit5 as text% str2double(get(hObject,'String')) returns contents of edit5 as a double% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit6_Callback(hObject, eventdata, handles)% hObject handle to edit6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit6 as text% str2double(get(hObject,'String')) returns contents of edit6 as a double% --- Executes during object creation, after setting all properties. function edit6_CreateFcn(hObject, eventdata, handles)% hObject handle to edit6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)chose=get(handles.popupmenu1,'value');if chose==1;clc;msg=str2num(get(handles.edit1,'string'))%信息产生code=encode(msg,7,4);%汉明编码rcv=decode(code,7,4);%汉明译码set(handles.edit2,'string',num2str(code));set(handles.edit3,'string',num2str(rcv));elsek=str2num(get(handles.edit1,'string'));code1=encode(k,7,3,'cyclic/binary');rcv1=decode(code1,7,3,'cyclic/binary');set(handles.edit2,'string',num2str(code1));set(handles.edit3,'string',num2str(rcv1));endfunction edit7_Callback(hObject, eventdata, handles)% hObject handle to edit7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit7 as text% str2double(get(hObject,'String')) returns contents of edit7 as a double% --- Executes during object creation, after setting all properties. function edit7_CreateFcn(hObject, eventdata, handles)% hObject handle to edit7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit8_Callback(hObject, eventdata, handles)% hObject handle to edit8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit8 as text% str2double(get(hObject,'String')) returns contents of edit8 as a double% --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, eventdata, handles)% hObject handle to edit8 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit9_Callback(hObject, eventdata, handles)% hObject handle to edit9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit9 as text% str2double(get(hObject,'String')) returns contents of edit9 asa double% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles)% hObject handle to edit9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit10_Callback(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit10 as text% str2double(get(hObject,'String')) returns contents of edit10 as a double% --- Executes during object creation, after setting all properties. function edit10_CreateFcn(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunction edit15_Callback(hObject, eventdata, handles)% hObject handle to edit15 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit15 as text% str2double(get(hObject,'String')) returns contents of edit15 as a double% --- Executes during object creation, after setting all properties. function edit15_CreateFcn(hObject, eventdata, handles)% hObject handle to edit15 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end% --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)chose=get(handles.popupmenu1,'value');if chose==1;[H,G,N,K]=hammgen(3); %产生H和G矩阵for i=1:2^Kfor j=K:-1:1if rem(i-1,2^(-j+K+1))>=2^(-j+K)U(i,j)=1;elseU(i,j)=0;endendendC=rem(U*G,2);A=str2num(get(handles.edit7,'string'));[r,l]=size(A);E=[0 0 0 0 0 0 0;0 0 0 0 0 0 1;0 0 0 0 0 1 0;0 0 0 0 1 0 0;0 0 0 1 0 00;0 0 1 0 0 0 0;0 1 0 0 0 0 0;1 0 0 0 0 0 0]; %%%%%求校正子,然后将其转化成十进制数S=rem(A*H',2);Sx=bi2de(S,'left-msb');%%%%下面是(7,4)码检错for i=1:rswitch(Sx)case 0disp=('此接收码字没错')case 1disp=('注意:此接收码字的第3位有错,请纠正')case 2disp=('注意:此接收码字的第2位有错,请纠正')case 4disp=('注意:此接收码字的第1位有错,请纠正')case 3disp=('注意:此接收码字的第5位有错,请纠正')case 5disp=('注意:此接收码字的第7位有错,请纠正')case 6disp=('注意:此接收码字的第4位有错,请纠正')case 7disp=('注意:此接收码字的第6位有错,请纠正')endendset(handles.edit8,'string',disp);%%%下面为在知道哪位出错的情况下,进行纠正for i=1:rswitch(Sx)case 0B(i,:)=A(i,:)+E(1,:);case 1B(i,:)=A(i,:)+E(6,:);case 2B(i,:)=A(i,:)+E(7,:);case 4B(i,:)=A(i,:)+E(8,:);case 3B(i,:)=A(i,:)+E(4,:);case 5B(i,:)=A(i,:)+E(2,:);case 6B(i,:)=A(i,:)+E(5,:);case 7B(i,:)=A(i,:)+E(3,:);endendB=rem(B,2);set(handles.edit9,'string',num2str(B));elsegenpoly=cyclpoly(7,3);[p,g]=cyclgen(7,genpoly);c=str2num(get(handles.edit7,'string'));s=rem(p*c',2);Sx=s(1,1)+s(2,1)*2+s(3,1)*4+s(4,1)*8;switch(Sx)case 0set(handles.edit8,'string','此接收碼无错');set(handles.edit9,'string',num2str(c));case 1if c(1,1)==0c(1,1)=1;elsec(1,1)=0endset(handles.edit8,'string','注意:此接收码字的第一位有错,请纠正');set(handles.edit9,'string',num2str(c));case 2if c(1,2)==0c(1,2)=1;elsec(1,2)=0endset(handles.edit9,'string',num2str(c));set(handles.edit8,'string','注意:此接收码字的第二位有错,请纠正');case 4if c(1,3)==0c(1,3)=1;elsec(1,3)=0endset(handles.edit9,'string',num2str(c));set(handles.edit8,'string','注意:此接收码字的第三位有错,请纠正');case 8if c(1,4)==0c(1,4)=1;elsec(1,4)=0endset(handles.edit9,'string',num2str(c));set(handles.edit8,'string','注意:此接收码字的第四位有错,请纠正');case 13if c(1,5)==0c(1,5)=1;elsec(1,5)=0endset(handles.edit9,'string',num2str(c));set(handles.edit8,'string','注意:此接收码字的第五位有错,请纠正');case 7if c(1,6)==0c(1,6)=1;elsec(1,6)=0endset(handles.edit9,'string',num2str(c));set(handles.edit8,'string','注意:此接收码字的第六位有错,请纠正');case 14if c(1,7)==0c(1,7)=1;elsec(1,7)=0endset(handles.edit9,'string',num2str(c));set(handles.edit8,'string','注意:此接收码字的第七位有错,请纠正');case{3,5,6,9,10,11,12,15}set(handles.edit8,'string','注意:此接收码字有错');set(handles.edit9,'string','注意:无法纠正无法判别错在哪位'); endend% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu1% --- Executes during object creation, after setting all properties. function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end。

信道编码-循环码

信道编码-循环码


2013/8/21
13/49
2. 循环码的生成多项式

g0=1,否则经 (n-1) 次左移循环后将得到低于 (n-k) 次的 码多项式。
g(x) 是惟一的 (n-k) 次多项式。
如果存在另一个 (n-k) 次码多项式,设为 g’’(x) ,根据线性 码的封闭性,则 g(x) + g’’(x) 也必为一个码多项式。由于 g(x) 和 g’’(x) 的次数相同,它们的和式的 (n-k) 次项系数为0,那 么 g(x) + g’’(x) 是一个次数低于 (n-k) 次的码多项式,前面 已证明 g(x) 的次数是最低的,因此 g’’(x) 不能存在,所以 g(x) 是惟一的 (n-k) 次码多项式。
73循环码循环码的生成多项式20134122549循环码的监督矩阵由等式两端同次项系数相等得将上面的方程组写成矩阵形式循环码的生成多项式20134122649上式中列阵的元素是生成多项式的系数是一个码字那么第一个矩阵则为73循环码的监督矩阵即循环码的生成多项式20134122749循环码监督矩阵的构成632可见监督矩阵的第一行是码的监督多项式的系数的反序排列第二三四行是第一行的移位
21/49
2. 循环码的生成多项式
设信息组 m=(mk-1,mk-2,…,m0),则相应的码字为
C(x)=mG(x)=(mk-1xk-1+mk-2 1xk-2+…+m0)g(x)= m(x)g(x)

C(x)≤n-1;
m(x) 是 2k 个信息多项式的表示式;
所以 C(x) 即为相应 2k 个码多项式的表示式。
2013/8/21
12/49
2. 循环码的生成多项式
(3) 生成多项式和码多项式的关系

信息论与编码考试样题

信息论与编码考试样题

信息论与编码考试样题一.填空题(每空1分,共20分)1.香农信息论的三个基本概念分别为____________、____________、________ ____。

2.对离散无记忆信源来说,当信源呈____________分布情况下,信源熵取最大值。

3.写出平均互信息的三种表达公式____________、____________、__________ __。

4.若连续信源输出的平均功率和均值被限定,则其输出信号幅度的概率密度函数为____________时,信源具有最大熵值;若连续信源输出非负信号的均值受限,则其输出信号幅度呈____________分布时,信源具有最大熵值。

5.信道容量是为了解决通信的________问题,而信息率失真函数是为了解决通信的________问题。

6.费诺编码比较适合于____________________________________的信源。

7.无记忆编码信道的每一个二元符号输出可以用多个比特表示,理想情况下为实数,此时的无记忆二进制信道又称为____________。

8.差错控制的4种基本方式是:____________、____________、____________、____________。

9.(n,k) 线性码能纠t个错误,并能发现l 个错误(l>t),码的最小距离为:___ _________________________________。

10.循环码码矢的i 次循环移位等效于将码多项式乘____________后再模_____ _______。

二.简答题(每小题5分,共30分)1.分别说明平均符号熵与极限熵的物理含义并写出它们的数学表达式。

2.写出二进制均匀信道的数学表达式,并画出信道容量C与信道转移概率p的曲线图。

3. 简述保真度准则下的信源编码定理及其物理意义。

4.在哈夫曼编码过程中,对缩减信源符号按概率由大到小的顺序重新排列时,应将合并后的新符号排在同概率大小信源符号的前面还是后面?并说明原因。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

******************实践教学*******************兰州理工大学计算机与通信学院2014年秋季学期计算机通信课程设计题目:(7,3)循环码编译码软件设计专业班级:姓名:学号:指导教师:成绩:摘要随着计算机通信的日益发展,传输数据的场合越来越多。

串行数据的差错检验是保证数据传输正确的必要手段,而循环码是差错码中最常用的一种编码。

循环码是线性分组码中最重要的一种子类,它除了具有分组码的线性外,还具有循环性,其码字结构一般用符号(n,k)表示,其中,n是该码组中的码元数,k是信息码元位数,r=n-k是监督码元位数。

循环码具有许多特殊的代数性质,这些性质有助于按照要求的纠错能力系统地构造这类码,能简化译码算法,并且目前发现的大部分线性码与循环码有密切关系。

已有循环码编译码系统大多以标准逻辑器件(如中小规模TTL系列、CMOS系列)按传统数字系统设计方法设计而成,其主要缺点是逻辑规模小、功耗大、可靠性低。

随着大规模、超大规模集成电路的发展,以及电子设计自动化水平的提高,这种制约正在被逐渐消除。

本文通过C 语言平台运行所编写的程序,观察了在输入信息码情况下输出对应的编码结果以及相反的译码功能。

通过多组的对比验证了该(7,4)循环码的编译码程序的正确性。

最后,在程序运行的过程中进步分析循环码的编译码原理,并通过比较仿真模型与理论计算的性能,证明了仿真模型的可行性。

关键词:循环码;编码;译码;程序仿真目录前言 (1)1、目的及意义 (2)2、设计原理 (3)2.1循环码的介绍 (3)2.1.1循环码的定义 (3)2.1.2循环码的特点 (3)2.1.3循环码的多项式表示 (4)2.1.4(n,k)循环码的生成多项式 (4)2.1.5循环码的生成矩阵和一致校验矩阵 (6)2.2循环码编码原理 (8)2.2.1多项式除法电路 (8)2.3循环码译码原理 (9)3、设计结果及分析 (11)3.1程序运行结果 (11)3.2运行结果理论分析 (14)3.3软件可行性分析 (15)4、总结 (16)附录 (17)参考文献 (22)前言数字信号在传输过程中,由于受到干扰的影响,码元波形将变坏。

接收端收到后可能发生错误判决。

由乘性干扰引起的码间串扰,可以采用均衡的办法纠错,而加性干扰的影响则需要用其他方法解决,在设计数字通信系统时,应该首先从合理选择调至制度,解调方法一级发送功率等方面考虑,使加性干扰不足以影响达到误码率的要求。

在仍不能妈祖要求是,就要考虑才用差错控制技术。

现代通信的发展趋势为数字化,随着现代通信技术的不断开发,差错控制技术已日趋成熟,在各个领域都得到了广泛的应用和认同。

本文就(7,4)循环码的编码与译码原理进行C 语言的编程及运行仿真。

现代社会发展要求通信系统功能越来越强,可靠性越来越高,构成也越来越复杂,这就要借助于功能强大的计算机辅助分析设计技术和工具才能实现。

现代计算机科学技术快速发展,已经研发出了新一代的可视化的仿真软件。

这些能强大的仿真软件,使得通信系统仿真的设计和分析过程变得相对直观和便捷,由此也使得通信系统仿真技术得到了更快的发展。

本文使用的是功能强大的C 语言软件。

C 语言是一种使用简便的,特别适用于科学研究和工程计算的高级语言,与其他计算机语言相比,它的特点是简洁和智能化,具有极高的编程和调试效率。

通过使用C 工具箱函数对数字调制进行仿真,更能直观彻底的掌握循环码的编码与译码原理。

有助于我们的学习和研究,加深对知识的理解和运用。

C 的便利性还体现在它的仿真结果还可以存放到的工作空间里做事后处理。

方便我们修改参数对不同情况下的输出结果进行对比。

1、目的及意义在实际的通信系统中,由于信道传输特性不理想以及加噪声的影响,接收到的信息中不可避免的会发生错误,影响通信系统的传输可靠性。

随着数字通信技术的发展,各种业务对系统误码率的要求逐渐提高,差错控制编码技术是提高数字通信可靠性的有效方法之一。

循环码的编码与译码电路比较简单,纠错能力也较强,是应用比较广泛的差错控制编码方法之一。

通过完成本课题的设计,拟达到以下目的:1、学习循环码编、译码的基本原理,并重点掌握(7,3)循环码的编码与译码;2、查找并分析选择一个合理的生成多项式;3、用C语言分别编程实现(7,3)循环码的编码与译码部分;4、输入任意的数字信息序列,仿真并分析(7,3)循环码的编码结果;5、分别在无差错和部分差错的情况下仿真并分析(7,3)循环码的译码结果;6、分析软件的可行性。

2、设计原理2.1循环码的介绍循环码是线性分组码中一个重要的分支。

它的检、纠错能力较强,编码和译码设备并不复杂,而且性能较好,不仅能纠随机错误,也能纠突发错误。

循环码是目前研究得最成熟的一类码,并且有严密的代数理论基础,故有许多特殊的代数性质,这些性质有助于按所要求的纠错能力系统地构造这类码,且易于实现,所以循环码受到人们的高度重视。

2.1.1循环码的定义循环码是一种线性代数分组码,记为(n,k )码,其中n 为码长,k 为信息码元数。

2.1.2循环码的特点若()0121c c c c n n --是一个码字,则它的循环移位()1032---n n n c c c c 也是一个码字。

循环码是线性分组码的一种,所以它具有线性分组码的一般特性,此外还具有循环性。

循环码的编码和解码设备都不太复杂,且检(纠)错能力强。

它不但可以检测随机的错误,还可以检错突发的错误。

(n,k )循环码可以检测长为n-k 或更短的任何突发错误,包括首尾相接突发错误。

循环码是一种无权码,循环码编排的特点是相邻两个数码之间符合卡诺图中的邻接条件,即相邻两个数码之间只有一位码元不同,码元就是组成数码的单元。

符合这个特点的有多种方案,但循环码只能是表中的那种。

循环码的优点是没有瞬时错误,因为在数码变换过程中,在速度上会有快有慢,中间经过其它一些数码形式,称它们为瞬时错误。

这在某些数字系统中是不允许的,为此希望相邻两个数码之间仅有一位码元不同,即满足邻接条件,这样就不会产生瞬时错误。

循环码就是这样一种编码,它可以在卡诺图中依次循环得到。

循环码又称格雷码( Grey Code )。

循环码最大的特点就是码字的循环特性,所谓循环特性是指:循环码中任一许用码组经过循环移位后,所得到的码组仍然是许用码组。

若()0121c c c c n n --为一循环码组,则()1032---n n n c c c c 、()21043----n n n n c c c c c ……还是许用码组。

也就是说,不论是左移还是右移,也不论移多少位,仍然是许用的循环码组。

2.1.3循环码的多项式表示设码长为n 的循环码表示为()0121c c c c n n --,其中i c 为二进制数,通常把码组中各码元当做二进制的系数,即把上式中长为n 的各个分量看做多项式:()012211T c x c x c x c x c x i i n n n n ++++++=---- (2-1)的各项系数,则码字与码多项式一一对应,这种多项式中,x 仅表示码元位置的标记,因此我们并不关心x 的取值,这种多项式称为码多项式。

我们用多项式来表示循环码的码字0122110121c x c x c x c c c c c n n n n n n ⊕⊕⊕⇔------ (2-2) 也就是一个n 长码字可以用一个1-n X 次多项式来表示。

它的循环特性,可由多模多项式来表示,例如左移一位,相当于乘x()102312021121021121012211---------------⊕⊕⊕⊕=⊕⊕⊕⊕=⊕⊕⊕+=⊕⊕⊕⊕n n n n n n n n n n n n n n n n c x c x c x c xc x c x c c xc x c x c x c c x c x c x c x 模1-n x 应该指出,这里采用了模多项式运算。

同样,左移两位相当于乘以2x 等等。

2.1.4(n,k )循环码的生成多项式一个(n,k )循环码,它共有k 2个码字,从中取出其前面1-k 位的码字,以()x g 表示,它的次数为()k n k n -=---11。

则()()()()x g x x g x x xg g k 12,,,x - 都是码字,且k 个码字彼此独立,因此可以作为码的生成矩阵[]G 的k 行。

[]G 一经确定,码也就确定了,编码的问题也就解决了。

因此,我们称()x g 为码的生成多项式。

生成矩阵[]G 可以表示如下()[]()()()()()⎥⎥⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎢⎢⎣⎡=--x g x xg x g x x g x x g x k k 221x G (2-3) 因此,循环码()x c 可以写成()[]()[]x G m m m m c k k 0121x --=,式中[]0121k m m m m k --为K 位信息元矩阵。

变换上式可得,()()()()()()()()()x g x m x g m x m x m x m x g m x xg m x g x m x g x m x c k k k k k k k k =++++=++++=--------012211012211 (2-4)式中,()x m 为信息码组多项式。

由(2-4)可以看出,所有用()[]x G 生成的码字()x c 都是生成多项式()x g 的倍式。

也就是说,凡是一个码字多项式一定能被()x g 除尽。

反之,能被()x g 除尽的次数不大于(n-1)次的多项式,也一定是码多项式。

由此可以得出循环码编码方法如下:首先将次数小于(k-1)次的信息码组多项式()x m 乘以k n X -,得到()x m X k n -,其次数小于等于()1-n 次。

然后用生成多项式()x g 去除()x m X k n -,得到除式为()x r ,它的次数小于()x g 的次数()k n -,把此余式的系数作为监督元附加在信息码组后面,就得到一个必能被()x g 除尽的多项式,且它必是一个码多项式,运算过程为:(2-3) ()()()()x r x g x q x m x k n +=- (2-4) 式中()x q 为商式,()x r 为余式,则码多项式为()()()()()x g x q x r x m x x c k n =+=- (2-5) 而余式可以写成()()x m x r k n -≡x [模()x g ] (2-6)且由于它是循环码,故()x g 必是1-n X 的一个因式,也就是说,它必能被g(x)整除,即:()(),01≡=-x h x g X n [模1-n X ] (2-7)()()x g x r x x g x m x k)()(q )( n +=-式中,()x g 为次数k n -=r 次,()x h 的次数为k 次。

相关文档
最新文档