백승재

receiver.h

......@@ -11,4 +11,49 @@ public:
char DecodedData[Nbits];
void demodulate();
};
void Creceiver::demodulate()
{
for (int i = 0; i < Nbits; i++)
{
constellation[i]=r[i]/Eb;
}
for (int i = 0; i < Nbits; i+=2)
{
if (constellation[i]>0&&constellation[i + 1]>0)
{
DecodedData[i] = 1;
DecodedData[i + 1] = 1;
}
else if (constellation[i]<0&&constellation[i + 1]>0)
{
DecodedData[i] = 0;
DecodedData[i + 1] = 1;
}
else if (constellation[i]<0 &&constellation[i + 1]<0)
{
DecodedData[i] = 0;
DecodedData[i + 1] = 0;
}
else if (constellation[i] >0 && constellation[i + 1]<0)
{
DecodedData[i] = 1;
DecodedData[i + 1] = 0;
}
}
}
#endif
#ifndef __RECEIVER
#define __RECEIVER
#include <cmath>
#include "variables.h"
class Creceiver {
public:
Creceiver() {};
float *r; // corrupted signal = received signal
float constellation[Nbits];
char DecodedData[Nbits];
void demodulate();
};
#endif
......