资源简介
bpsk的C语言代码,已经验证可用,用于移动通信作业,环境是VC++6.0
代码片段和文件信息
// ------------------------------------------------------------------------
// File: golay24.c
//
// An arithmetic decoder for the (24128) Golay code.
// Note: The C code below assumes execution in a 16-bit computer.
// Inspired by Stephen Wicker‘s book pp. 143-144.
// ------------------------------------------------------------------------
// This program is complementary material for the book:
//
// R.H. Morelos-Zaragoza The Art of Error Correcting Coding Wiley 2002.
//
// ISBN 0471 49581 6
//
// This and other programs are available at http://the-art-of-ecc.com
//
// You may use this program for academic and personal purposes only.
// If this program is used to perform simulations whose results are
// published in a journal or book please refer to the book above.
//
// The use of this program in a commercial product requires explicit
// written permission from the author. The author is not responsible or
// liable for damage or loss that may be caused by the use of this program.
//
// Copyright (c) 2002. Robert H. Morelos-Zaragoza. All rights reserved.
// ------------------------------------------------------------------------
#include
#include
#include
#include
#include
#include
#define MAX_RANDOM LONG_MAX // Maximum value of random()
#define znew (z=36969*(z&65535)+(z>>16))
#define wnew (w=18000*(w&65535)+(w>>16))
#define MWC ((znew<<16)+wnew )
#define SHR3 (jsr^=(jsr<<17) jsr^=(jsr>>13) jsr^=(jsr<<5))
#define CONG (jcong=69069*jcong+1234567)
#define KISS ((MWC^CONG)+SHR3)
#define UNI (KISS*2.328306e-10)
typedef unsigned long UL;
/* Global static variables: */
static UL z=362436069 w=521288629 jsr=123456789 jcong=380116160;
//Generate Gaussian distributed random variates
double G(double Udouble S2)
{
double U1U2V1V2WYX1X2;
do{
U1=UNI; U2=UNI;
V1=2*U1-1; V2=2*U2-1;
W=V1*V1+V2*V2;
}while(W>1);
Y=sqrt((-2*log(W)/W));
X1=V1*Y; X2=V2*Y;
X1=X1*sqrt(S2)+U;X2=X2*sqrt(S2)+U;
return X1;
}
int ij;
int k=12;
int biterrorerrordecerror;
double rate;
int ebnoloop;
double berattnsigma;
double mocode[12];
int decode[12];
int data[12];
void main()
{
int i;
// long seed;
rate=0.5;
for(ebno=0;ebno<=8;ebno++)
{
attn=0.5/rate*pow(10.0-(ebno/10.0));
sigma=sqrt(attn);
ber=0;
// decerror = 0;
biterror=0;
loop=0;
while (biterror<100)
{
/* -------------- Random generation of a codeword ----------------- */
for (i = 0; i < k; i++)
data[i] = KISS % 2;
/* --------------------- BPSK modulation ------------------------- */
for (i=0;i {
mocode[i]=2*data[i]-1;
}
/*--------------------- AWGN channel --------------------*/
for(i=0;i {
mocode[i]=mocode[i]+G(01)*sigma;
}
/* --------------------- BPSK demodulation ------------------------- */
for(i=0;i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3609 2009-01-27 21:20 bpskC++\bpsk.cpp
目录 0 2015-07-31 10:17 bpskC++
----------- --------- ---------- ----- ----
3609 2
相关资源
- c++ ado操作sql server封装类
- C/C++实现linux和Windows查看系统、进程、
- 小型超市管理系统(C++)
- 飞机订票系统___c++
- c++类声明和成员函数分离写法
- opencv多视频同一窗口显示C++程序
- c++ primer plus第六版配套源代码,很全
- C++文件加密系统实验报告
- C语言版本的DES加密解密算法代码!(
- 空间后方交会MFC版,C++源代码
- C++聊天室客户端+服务端
- Aitken加速法算法用c++描述
- vc++ 数据采集卡编程
- Linux 串口源代码纯C++
- 青岛理工大学c++试题
- Viterbi算法c/c++实现
- 银行家算法c++工程项目文件
- Visual+C+++车牌识别程序
- 循环码编码器
- 图像分割 grabcut C++版本的源码,包含
- VC++ CALLBACK
- C/C++ STL参考手册 STL帮助文档 中文/英
- 基于C++和MFC的哈夫曼编码压缩软件的
- mysql 将图片以二进制格式存储到数据
- C++人事管理系统
- mfc ado操作sql数据库查询、读写,删除
- hough检测直线的程序
- 电梯运行仿真程序
- c++实现的MFC课程设计--旅游管理系统
- 重言式判别程序源代码
评论
共有 条评论