信息论信道容量实验报告用.docVIP

  • 142
  • 0
  • 约1.17万字
  • 约 13页
  • 2018-10-29 发布于广东
  • 举报
信息论信道容量实验报告用.doc

湖南大学 信息科学与工程学院 实验报告 实验名称信道容量的迭代算法 课程名称 信息论与编码 第1页共1页 实验目的 进一步熟悉信道容量的迭代算法; 学习如何将复杂的公式转化为程序; 掌握C语言数值计算程序的设计和调试技术。 2、 实验方法 PC台言 ??平语 件发程 硬开编 PC台言 ??平语 件发程 硬开编 :visual C++软件 :c语言 3、 实验要求 己知:信源符号个数r、信宿符号个数s、信道转移概率矩阵P。 输入:任意的一个信道转移概率矩阵。信源符号个数、信宿符号个数和每 个具体的转移概率在运行时从键盘输入。 输出:最佳信源分布P*,信道容量C。 算法分析 1: procedure CHANNEL CAPACITY (r, s, ( )) 2: initialize:信源分布A=l/r,相对误差门限C=一⑺ 3: repeat 4: 5: 5 eXP(Z^1O82^) Pi ^exp(^p.f.log2Zy) r=I 7=1 6: r s c - r=i 7=1 AC (J 7: until C 8: output P*= (P)r,C 9: end procedure 5.程序调试 1、 头文件引入出错 f:\visualc++\channel\cppl.cpp(4) : fatal error Cl083: Cannot open include file: unistd.h1: No such file or directory #includeunistd.h 纠错://#includeunistd.h f:\visualc++\channel\cppl.cpp(5): fatal error C1083: Cannot open include file: values.h*: No such file or directory #includevalues.h 纠错://#includevalues.h 2、 变量赋值错误 f:\visualc++\channel\cpp 1 .cpp( 17): error C2065:,ij1: undeclared identifier f:\visualc++\channel\cpp 1 .cpp( 17) : error C2440: ’initializing1 : cannot convert from ’int’ to ’float ’ Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast float **phi_ij=ij=NULL; 纠错:float **phi_ij=NULL; 3、 常量定义错误 f:\visualc++\channel\cppl .cpp(40): error C2143: syntax error : missing 7 before Tor1 for(i=0;ir;i++) phi_ij[i]=(float *)calloc(s,sizeof(float)); f:\visualc++\channel\cppl .cpp(52): error C2021: expected exponent value,not11 if(fabs(validate -1.0)DELTA) f:\visualc++\channel\Cppl.cpp(84): error C2021: expected exponent value,not if(fabs(pJ)=DELTA) f:\visualc++\channel\Cpp 1 .cpp( 100): error C2021: expected exponent value,not ’ ’ if(fabs(phi_ij[i][j])〉二 DELTA) f:\visualc++\channel\Cppl.cpp(l 16): error C2021: expected exponent value, not while(fabs(C-C_pre)/C〉DELTA); 纠错:#define DELTA 0.000001; F:\visualc++\channel\Cpp 1 .cpp(68): error C2065: ’MAXFLOAT : undeclared identifier F:\visualc++\channel\Cpp 1 .cpp(68) : warning C4244: -* : conversion from ’inf to ’float’,possible loss of dat

文档评论(0)

1亿VIP精品文档

相关文档