차은영

receiver

...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
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" />
115 <ClCompile Include="sender.cpp"> 116 <ClCompile Include="sender.cpp">
116 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> 117 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
117 </ClCompile> 118 </ClCompile>
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
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>
27 </ItemGroup> 30 </ItemGroup>
28 <ItemGroup> 31 <ItemGroup>
29 <ClInclude Include="sender.h"> 32 <ClInclude Include="sender.h">
......
1 +#include "receiver.h"
2 +#include "variables.h"
3 +#include<iostream>
4 +#include<cmath>
5 +using namespace std;
6 +#define PI 3.14159
7 +
8 +
9 +Creceiver::Creceiver() {
10 + float c0[20];
11 + float c1[20];
12 + for (float t = 0; t < Nsamplespersymbol; t++)
13 + {
14 + c0[(int)t] = sqrt(2 * Nsamplespersymbol)*cos(2 * PI*Nsamplespersymbol*t);
15 + c1[(int)t] = sqrt(2 * Nsamplespersymbol)*sin(2 * PI*Nsamplespersymbol*t);
16 + }
17 + for (int i = 0; i < Nbits * 10; i = i + 20) //
18 + {
19 + float sum = 0;
20 + float sum2 = 0;
21 + for (int j = 0; j < 20; i++)
22 + {
23 + sum = sum + (r[i + j] * c0[j]);
24 + sum2 = sum2 + (r[i + j] * c1[j]);
25 + }
26 + constellation[i] = sum;
27 + constellation[i + 1] = sum2;
28 + }
29 +}
30 +float *r; // corrupted signal = received signal
31 +float constellation[Nbits];
32 +char DecodedData[Nbits];
33 +void Creceiver::demodulate()
34 +{
35 + float c0[20];
36 + float c1[20];
37 + for (float t = 0; t < Nsamplespersymbol; t++)
38 + {
39 + c0[(int)t] = sqrt(2 * Nsamplespersymbol)*cos(2 * PI*Nsamplespersymbol*t);
40 + c1[(int)t] = sqrt(2 * Nsamplespersymbol)*sin(2 * PI*Nsamplespersymbol*t);
41 + }
42 + for (int i = 0; i < Nbits * 10; i = i + 20) //
43 + {
44 + float sum = 0;
45 + float sum2 = 0;
46 + for (int j = 0; j < 20; i++)
47 + {
48 + sum = sum + (r[i + j] * c0[j]);
49 + sum2 = sum2 + (r[i + j] * c1[j]);
50 + }
51 + constellation[i] = sum;
52 + constellation[i + 1] = sum2;
53 + }
54 +};
...\ No newline at end of file ...\ No newline at end of file