Showing
6 changed files
with
49 additions
and
41 deletions
No preview for this file type
No preview for this file type
This file is too large to display.
... | @@ -112,7 +112,6 @@ | ... | @@ -112,7 +112,6 @@ |
112 | <ItemGroup> | 112 | <ItemGroup> |
113 | <ClCompile Include="constellation_main.cpp" /> | 113 | <ClCompile Include="constellation_main.cpp" /> |
114 | <ClCompile Include="myMatrix.cpp" /> | 114 | <ClCompile Include="myMatrix.cpp" /> |
115 | - <ClCompile Include="receiver.cpp" /> | ||
116 | <ClCompile Include="sender.cpp"> | 115 | <ClCompile Include="sender.cpp"> |
117 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> | 116 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> |
118 | </ClCompile> | 117 | </ClCompile> | ... | ... |
... | @@ -24,9 +24,6 @@ | ... | @@ -24,9 +24,6 @@ |
24 | <ClCompile Include="sender.cpp"> | 24 | <ClCompile Include="sender.cpp"> |
25 | <Filter>소스 파일</Filter> | 25 | <Filter>소스 파일</Filter> |
26 | </ClCompile> | 26 | </ClCompile> |
27 | - <ClCompile Include="receiver.cpp"> | ||
28 | - <Filter>소스 파일</Filter> | ||
29 | - </ClCompile> | ||
30 | </ItemGroup> | 27 | </ItemGroup> |
31 | <ItemGroup> | 28 | <ItemGroup> |
32 | <ClInclude Include="sender.h"> | 29 | <ClInclude Include="sender.h"> | ... | ... |
... | @@ -6,67 +6,79 @@ | ... | @@ -6,67 +6,79 @@ |
6 | using namespace std; | 6 | using namespace std; |
7 | 7 | ||
8 | Csender::Csender() { | 8 | Csender::Csender() { |
9 | - srand((unsigned int)time(NULL)); | ||
10 | - for (int i = 0; i < 1000; i++) | ||
11 | - { | ||
12 | - data[i] = rand() % 2; | ||
13 | - } | ||
14 | 9 | ||
15 | 10 | ||
16 | } | 11 | } |
17 | 12 | ||
18 | -float s[Nbits / Nbitspersymbol * Nsamplespersymbol]; // trasmitted signal | ||
19 | void Csender::transmitData() | 13 | void Csender::transmitData() |
20 | { | 14 | { |
15 | + float A = 1; | ||
21 | float c0[20]; | 16 | float c0[20]; |
22 | float c1[20]; | 17 | float c1[20]; |
23 | - for (int i = 0; i < 20; i++) | 18 | + float c; |
19 | + srand((unsigned int)time(NULL)); | ||
20 | + | ||
21 | + for (int i = 0; i < 1000; i++) | ||
24 | { | 22 | { |
25 | - for (float t = 0; t < 1 / Nsamplespersymbol; t+0.05) | 23 | + data[i] = rand() % 2; |
26 | - { | ||
27 | - c0[(int)t] = sqrt(2 * Nsamplespersymbol)*cos(2 * PI*Nsamplespersymbol*t); | ||
28 | - } | ||
29 | } | 24 | } |
30 | 25 | ||
31 | - for (int i = 0; i < 20; i++) | 26 | + cout << "data: " << endl; |
27 | + | ||
28 | + for (int i = 0; i < 40; i++) | ||
32 | { | 29 | { |
33 | - for (float t = 0; t < 1 / Nsamplespersymbol; t + 0.05) | 30 | + for (int j = 0; j < 25; j++) |
34 | { | 31 | { |
35 | - c1[(int)t] = sqrt(2 * Nsamplespersymbol)*sin(2 * PI*Nsamplespersymbol*t); | 32 | + cout << data[i * 25 + j] << " "; |
36 | } | 33 | } |
34 | + cout << endl; | ||
35 | + } | ||
36 | + | ||
37 | + for (float t = 0; t < (1. / Nsamplespersymbol); t = t + 1 / 400.) | ||
38 | + { | ||
39 | + | ||
40 | + c = 400. * t; | ||
41 | + c0[(int)c] = sqrt(2 * Nsamplespersymbol)*cos(2 * PI*Nsamplespersymbol*t); | ||
42 | + c1[(int)c] = sqrt(2 * Nsamplespersymbol)*sin(2 * PI*Nsamplespersymbol*t); | ||
43 | + | ||
37 | } | 44 | } |
45 | + c0[12] = -4.41708; | ||
46 | + c1[12] = -4.41708; | ||
38 | 47 | ||
39 | - float A = 10; | 48 | + |
40 | - for (int i = 0; i < 1000; i + 2) | 49 | + for (int i = 0; i < 1000; i = i + 2) |
41 | { | 50 | { |
42 | - if (data[i] == '0' && data[i + 1] == '0') | 51 | + |
52 | + if (data[i] == 0 && data[i + 1] == 0) | ||
53 | + { | ||
54 | + for (int k = 0; k < 20; k++) | ||
43 | { | 55 | { |
44 | - for (int k = 0; k < 20; k++) | 56 | + s[(i * 10) + k] = A * c0[k] + A * c1[k]; |
45 | - { | ||
46 | - s[20*i+k] = A * c0[k] + A * c1[k]; | ||
47 | - } | ||
48 | } | 57 | } |
49 | - else if (data[i] == '0' && data[i + 1] == '1') | 58 | + } |
59 | + else if (data[i] == 0 && data[i + 1] == 1) | ||
60 | + { | ||
61 | + for (int k = 0; k < 20; k++) | ||
50 | { | 62 | { |
51 | - for (int k = 0; k < 20; k++) | 63 | + s[(i * 10) + k] = A * c0[k] + (-A) * c1[k]; |
52 | - { | ||
53 | - s[20 * i +k] = A * c0[k] - A * c1[k]; | ||
54 | - } | ||
55 | } | 64 | } |
56 | - else if (data[i] == '1' && data[i + 1] == '0') | 65 | + } |
66 | + else if (data[i] == 1 && data[i + 1] == 0) | ||
67 | + { | ||
68 | + for (int k = 0; k < 20; k++) | ||
57 | { | 69 | { |
58 | - for (int k = 0; k < 20; k++) | 70 | + s[(i * 10) + k] = (-A) * c0[k] + A * c1[k]; |
59 | - { | ||
60 | - s[20 * i +k] = -1*A * c0[k] + A * c1[k]; | ||
61 | - } | ||
62 | } | 71 | } |
63 | - else if (data[i] == '1' && data[i + 1] == '1') | 72 | + } |
73 | + else if (data[i] == 1 && data[i + 1] == 1) | ||
74 | + { | ||
75 | + for (int k = 0; k < 20; k++) | ||
64 | { | 76 | { |
65 | - for (int k = 0; k < 20; k++) | 77 | + s[(i * 10) + k] = (-A) * c0[k] + (-A) * c1[k]; |
66 | - { | ||
67 | - s[20 * i +k] = -1*A * c0[k] + -1*A * c1[k]; | ||
68 | - } | ||
69 | } | 78 | } |
70 | - | 79 | + } |
71 | } | 80 | } |
81 | + | ||
82 | + | ||
83 | + | ||
72 | }; | 84 | }; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment