차은영

receiver

......@@ -112,6 +112,7 @@
<ItemGroup>
<ClCompile Include="constellation_main.cpp" />
<ClCompile Include="myMatrix.cpp" />
<ClCompile Include="receiver.cpp" />
<ClCompile Include="sender.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
......
......@@ -24,6 +24,9 @@
<ClCompile Include="sender.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="receiver.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="sender.h">
......
#include "receiver.h"
#include "variables.h"
#include<iostream>
#include<cmath>
using namespace std;
#define PI 3.14159
Creceiver::Creceiver() {
float c0[20];
float c1[20];
for (float t = 0; t < Nsamplespersymbol; t++)
{
c0[(int)t] = sqrt(2 * Nsamplespersymbol)*cos(2 * PI*Nsamplespersymbol*t);
c1[(int)t] = sqrt(2 * Nsamplespersymbol)*sin(2 * PI*Nsamplespersymbol*t);
}
for (int i = 0; i < Nbits * 10; i = i + 20) //
{
float sum = 0;
float sum2 = 0;
for (int j = 0; j < 20; i++)
{
sum = sum + (r[i + j] * c0[j]);
sum2 = sum2 + (r[i + j] * c1[j]);
}
constellation[i] = sum;
constellation[i + 1] = sum2;
}
}
float *r; // corrupted signal = received signal
float constellation[Nbits];
char DecodedData[Nbits];
void Creceiver::demodulate()
{
float c0[20];
float c1[20];
for (float t = 0; t < Nsamplespersymbol; t++)
{
c0[(int)t] = sqrt(2 * Nsamplespersymbol)*cos(2 * PI*Nsamplespersymbol*t);
c1[(int)t] = sqrt(2 * Nsamplespersymbol)*sin(2 * PI*Nsamplespersymbol*t);
}
for (int i = 0; i < Nbits * 10; i = i + 20) //
{
float sum = 0;
float sum2 = 0;
for (int j = 0; j < 20; i++)
{
sum = sum + (r[i + j] * c0[j]);
sum2 = sum2 + (r[i + j] * c1[j]);
}
constellation[i] = sum;
constellation[i + 1] = sum2;
}
};
\ No newline at end of file