윤보민

changed receiver part

#include "receiver.h"
Creceiver::Creceiver() {}
void Creceiver::demodulate() {
T = Nsamplespersymbol;
float c0[Nsamplespersymbol], c1[Nsamplespersymbol];
for (int i = 1; i <= Nsamplespersymbol; i++) {
c0[i - 1] = sqrt(2 / T) * cos(2 * PI / T * i);
c1[i - 1] = sqrt(2 / T) * sin(2 * PI / T * i);
}
float temp0[1], temp1[1];
for (int i = 0; i < Nbits / 2; i++) {
matrixmult(1, Nsamplespersymbol, 1, r + (Nbitspersymbol * i), c0, temp0);
matrixmult(1, Nsamplespersymbol, 1, r + (Nbitspersymbol * i), c1, temp1);
constellation[2 * i] = temp0[0];
constellation[2 * i + 1] = temp1[0];
}
for (int j = 0; j < Nbits; j++) {
if (constellation[j] >= 0) DecodedData[j] = '0';
else DecodedData[j] = '1';
}
}
\ No newline at end of file
#ifndef __RECEIVER
#define __RECEIVER
#define PI 3.141592
#include <cmath>
#include <fstream>
#include "variables.h"
#include "myMatrix.h"
class Creceiver {
public:
Creceiver() {};
float T;
Creceiver();
float *r; // corrupted signal = received signal
float constellation[Nbits];
char DecodedData[Nbits];
void demodulate();
};
#endif
#endif
\ No newline at end of file
......