rsencode.m

来自「该程序是RS编译码器的MATLAB仿真程序」· M 代码 · 共 24 行

M
24
字号
%*************************************************************************
%   Copyright (C) 2008 Circuit and System Lab of PKU
%
%   Created     :   2008-5
%   Author      :   houdong(houdong@pku.edu.cn)
%
%   File Name   :   RsEncode.m
%
%   Abstract    :  realize encoding the message as RS code
%                   
%   Version     :   1.0     2008-5   All Right Reserved.
%*************************************************************************
function [RsCode] = RsEncode(Msg)           % a function to encode the input sequence
r=zeros(1,5);                               % define the register

for i=1:11                                  % create the div circuit to get the output message
    r(5)=RsSymbolAdd(r(4),Msg(12-i));
    r(4)=RsSymbolAdd(r(3),RsSymbolMul(r(5),13));
    r(3)=RsSymbolAdd(r(2),RsSymbolMul(r(5),12));
    r(2)=RsSymbolAdd(r(1),RsSymbolMul(r(5),8));
    r(1)=RsSymbolMul(r(5),7);
end
RsCode=[r(1:4),Msg];

⌨️ 快捷键说明

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