Showing
1 changed file
with
26 additions
and
0 deletions
constellation/constellation/channel.cpp
0 → 100644
1 | +#include"channel.h" | ||
2 | +#include<cstdlib> | ||
3 | +using namespace std; | ||
4 | + | ||
5 | + | ||
6 | +void Cchannel::AWGN() { | ||
7 | + ofstream myout; | ||
8 | + myout.open("channel.txt"); | ||
9 | + | ||
10 | + default_random_engine generator; | ||
11 | + normal_distribution<double> dist(0.0, No); | ||
12 | + | ||
13 | + | ||
14 | + for (int k = 0; k < Nbits / Nbitspersymbol * Nsamplespersymbol; k++) | ||
15 | + n[k] = dist(generator); | ||
16 | + | ||
17 | + matrixadd(1, Nbits / Nbitspersymbol * Nsamplespersymbol, s, n, r); | ||
18 | + | ||
19 | + for (int i = 0; i < Nbits / Nbitspersymbol * Nsamplespersymbol; i++) | ||
20 | + { | ||
21 | + | ||
22 | + myout << r[i] << endl; | ||
23 | + } | ||
24 | + | ||
25 | + myout.close(); | ||
26 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment