信息论实验报告.docx

上传人:b****3 文档编号:2137277 上传时间:2022-10-27 格式:DOCX 页数:39 大小:400KB
下载 相关 举报
信息论实验报告.docx_第1页
第1页 / 共39页
信息论实验报告.docx_第2页
第2页 / 共39页
信息论实验报告.docx_第3页
第3页 / 共39页
信息论实验报告.docx_第4页
第4页 / 共39页
信息论实验报告.docx_第5页
第5页 / 共39页
点击查看更多>>
下载资源
资源描述

信息论实验报告.docx

《信息论实验报告.docx》由会员分享,可在线阅读,更多相关《信息论实验报告.docx(39页珍藏版)》请在冰豆网上搜索。

信息论实验报告.docx

信息论实验报告

 

信息论与编码实验报告

学校:

中国地质大学(武汉)

指导老师:

姓名:

班级序号:

071112-11

日期:

2013年11月30日

 

1.LempelZiv字典编码····································3

题目要求·······························································3

程序流程·······························································3

核心步骤·······························································4

程序代码·······························································5

测试结果·······························································9

效果分析及改进建议····················································11

2.信道容量计算···········································12

题目要求·······························································12

程序流程·······························································12

核心步骤·······························································13

程序代码·······························································13

测试结果·······························································13

效果分析·······························································14

3.汉明码的编码与解码····································14

题目要求·······························································14

程序流程·······························································14

核心步骤·······························································15

程序代码·······························································15

测试结果·······························································18

效果分析及改进建议·····················································19

4.循环码的生成与最小距离计算····························19

题目要求·······························································19

程序流程·······························································19

核心步骤·······························································20

程序代码·······························································20

测试结果·······························································23

效果分析·······························································23

5.卷积码的编码与解码····································24

题目要求·······························································24

程序流程·······························································25

核心步骤·······························································25

程序代码·······························································25

测试结果·······························································31

效果分析及改进建议·····················································32

6.上机总结···············································33

1.LempelZiv字典编码

题目要求

WriteaprogramthatexecutestheLempelZivalgorithm.TheinputtotheprogramcanbetheEnglishalphabets.ItshouldconvertthealphabetstotheirASCIIcodeandthenperformthecompressionroutine.Itshouldoutputthecompressionachieved.Usingthisprogram,findoutthecompressionachievedforthefollowingstringsofletters.

(i)TheLempelZivalgorithmcancompresstheEnglishtextbyaboutfiftyfivepercent.

(ii)Thecatcannotsitonthecanopyofthecar.

程序流程

1.编码算法:

 

 

 

N

Y

 

2.解码算法与编码恰好相反(略):

核心步骤

1.构造字典,初始字典中应包含1-256所有ASIIC码对应的字符;

2.分清字典编号和字符的关系:

编码时始终对字符和字符串进行操作,但发送的始终是对应的字典编号。

解码时始终对字典编号进行操作,但输出的是编号对应字符。

3.编写相关函数,实现对字典的基本操作,如:

添加新字符、字符串拼接、查找某个编号对应的字符、查找某个字符串对应的编号;

4.在字典中添加,Newchar:

,Link...,以便对字典进行操作

程序代码

1.构建字典:

function[new_dic]=Creat_newdic()

%构建初始字典

%使用说明:

%new_dic=Creat_newdic();

new_dic=zeros(512,30);

new_dic=uint8(new_dic);

fori=1:

256

new_dic(i,1)=i;

end

new_dic=char(new_dic);

new_dic(257,1:

8)='Newchar:

';

new_dic(258,1:

7)='Link...';

end

 

2.向字典里添加新字符串:

function[dic_out,flag]=Add_newstr(dic_in,newstr)

%向字典添加新字符串

%使用方法

%[dic_out,flag]=Add_newstr(dic_in,newstr)

dic_out=dic_in;

L=size(newstr);

flag=1;

position=Search_str(dic_in,'Link...');

ifposition==512

flag=0;return;

end

dic_out(position,:

)=0;

dic_out(position,1:

L

(2))=newstr;

dic_out(position+1,1:

7)='Link...';

end

 

3.取出字典里某个位置的字符串:

function[str]=Get_str(dic,position)

%取出某字典中的指定位置的字符串

%使用说明:

%str=Get_str(dic,position);

%L=size(dic(position,:

));

fori=1:

30

if(dic(position,i)~=0)

N=i;

else

break;

end

end

str(1:

N)=dic(position,1:

N);

end

4.在指定的字典里查找某个字符串:

function[position]=Search_str(dic,str)

%在字典中查找某字符串

[M,N]=size(str);

position=0;

fori=1:

512

ifdic(i,1:

N)==str

position=i;

break;

end

end

end

 

5.将两个字符串相加:

function[position]=Search_str(dic,str)

%在字典中查找某字符串

[M,N]=size(str);

position=0;

fori=1:

512

ifdic(i,1:

N)==str

position=i;

break;

end

end

end

 

6.编码过程:

function[code_out,dic_out]=LZ_coding(dic_in,str)

%字典编码之发送端

%Detailedexplanationgoeshere

dic_out=dic_in;

[M,N]=size(str);

counter=1;

ifN==0

code_out(counter)=Search_str(dic_out,'Newchar:

');

counter=counter+1;

code_out(counter)=Search_str(dic_out,'Link...');

retu

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工作范文 > 行政公文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1