• 大小: 2.35 KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-09-16
  • 语言: Matlab
  • 标签: CRC  matlab  

资源简介

CRC循环冗余编码的编译码过程,在matlab下的仿真程序

资源截图

代码片段和文件信息

function [Xerror]=CRCdecode(B)
G=[11100100001100111];
LG=length(G);
LB=length(B);
P=B(1:LG);
pointer=LG;
while pointer<=LB
        P=xor(PG);
          if pointer==LB
               break;
          end     
         if sum(P)==0
              for i=1:LG
                  pointer=pointer+1;
                  P(i)=B(pointer);
                  if pointer==LB
                      break;
                  end    
              end
               
         else
               for j=1:LG
                  if P(j)==1
                      k=j;
                           for i=1:LG+1-k
                              P(i)=P(k-1+i);
                           end
                      break;
                   end
                end
                if k>1 
                    for i=LG-k+2:LG
                       pointer=pointer+1;
                       P(i)=B(pointer);
                       if pointer==LB
                           break;
                       end    
                    end
                end           
         end          
 end
 
 if sum(P)==0
     error=0;
     X=B(1:end-LG+1);
 else
     error=1;
     X=B(1:end-LG+1);
 end  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1231  2007-01-16 14:22  crc_matlab\CRCdecode.m

     文件        405  2007-05-07 21:14  crc_matlab\crcmainprogram.m

     文件       1673  2007-01-14 20:58  crc_matlab\cyclic_redundancy_code.m

     文件       1961  2007-01-14 21:28  crc_matlab\cyclic_redundancy_decode.m

     目录          0  2009-02-28 23:41  crc_matlab

----------- ---------  ---------- -----  ----

                 5270                    5


评论

共有 条评论