📄 modulation.cc
字号:
/* modulation.cc $Id: modulation.cc,v 1.3 1998/08/16 18:54:04 dmaltz Exp $ */#include <math.h>#include <stdlib.h>#include <cmu/debug.h>#include <cmu/modulation.h>/* ====================================================================== Binary Phase Shift Keying ====================================================================== */BPSK::BPSK(){ Rs = 0;}BPSK::BPSK(int S){ Rs = S;}intBPSK::BitError(double Pr){ double Pe; // probability of error double x; int nbit = 0; // number of bit errors tolerated if(nbit == 0) { Pe = ProbBitError(Pr); } else { Pe = ProbBitError(Pr, nbit); } // quick check if(Pe == 0.0) return 0; // no bit errors // scale the error probabilty Pe *= 1e3; x = random() % 1000; if(x < Pe) return 1; // bit error else return 0; // no bit errors}doubleBPSK::ProbBitError(double){ double Pe = 0.0; return Pe;}doubleBPSK::ProbBitError(double, int){ double Pe = 0.0; return Pe;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -