信息量的计算c语言,信息论信道容量实验报告用c.doc

信息论信道容量实验报告用c

湖 南 大 学

信息科学与工程学院

实 验 报 告

实验名称信道容量的迭代算法课程名称信息论与编码

1.实验目的

(1)进一步熟悉信道容量的迭代算法;

(2)学习如何将复杂的公式转化为程序;

(3)掌握C语言数值计算程序的设计和调试技术。

2、实验方法

硬件:pc机

开发平台:visual c++软件

编程语言:c语言

3、实验要求

(1)已知:信源符号个数r、信宿符号个数s、信道转移概率矩阵P。

(2)输入:任意的一个信道转移概率矩阵。信源符号个数、信宿符号个数和每个具体的转移概率在运行时从键盘输入。

(3)输出:最佳信源分布P*,信道容量C。

算法分析

1:procedure CHANNEL CAPACITY(r,s,())

2:initialize:信源分布=1/r,相对误差门限,C=—

3:repeat

4:

5:

6:

C (

7:until

8:output P*= ,C

9:end procedure

程序调试

1、头文件引入出错

f:\visualc++\channel\cpp1.cpp(4) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

————#include

纠错://#include

f:\visualc++\channel\cpp1.cpp(5) : fatal error C1083: Cannot open include file: 'values.h': No such file or directory

————#include

纠错://#include

2、变量赋值错误

f:\visualc++\channel\cpp1.cpp(17) : error C2065: 'ij' : undeclared identifier

f:\visualc++\channel\cpp1.cpp(17) : error C2440: 'initializing' : 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\cpp1.cpp(40) : error C2143: syntax error : missing ';' before 'for'

————for(i=0;i

phi_ij[i]=(float *)calloc(s,sizeof(float));

f:\visualc++\channel\cpp1.cpp(52) : error C2021: expected exponent value, not ' '

棗棗if(fabs(validate -1.0)>DELTA)

f:\visualc++\channel\Cpp1.cpp(84) : error C2021: expected exponent value, not ' '

棗棗 if(fabs(p_j)>=DELTA)

f:\visualc++\channel\Cpp1.cpp(100) : error C2021: expected exponent value, not ' '

棗棗 if(fabs(phi_ij[i][j])>=DELTA)

f:\visualc++\channel\Cpp1.cpp(116) : error C2021: expected exponent value, not ' '

棗棗 while(fabs(C-C_pre)/C>DELTA);

纠错:#define DELTA 0.000001;

F:\visualc++\channel\Cpp1.cpp(68) : error C2065: 'MAXFLOAT' : undeclared identifier

F:\visualc++\channel\Cpp1.cpp(68) : warning C4244: '=' : conversion from '

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值