资源简介
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++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
- VC++基于OpenGL模拟的一个3维空间模型
评论
共有 条评论