1. main文件:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "const.h"
#include "complex.h"
double CNR;
int main(void)
{
int Eb_N0;
int transmitted_bit[BITN], received_bit[BITN];
Complex modulated_signal[POINT_N], transmitted_signal[OFDM_N + GI];
Complex received_signal[OFDM_N];
srand((unsigned)time(NULL));
for(Eb_N0=0; Eb_N0<10; Eb_N0++)
{
CNR = (double)Eb_N0 + 3.0;
for(int loop=0; loop<LOOPN; loop++)
{
transmitter(transmitted_bit, modulated_signal);
oversampling_GI(modulated_signal, transmitted_signal);
removeGI(transmitted_signal,received_signal);
ADC(received_signal);
}
}
return 0;
}
4. 发送端transmitter.c
#include "const.h"
#include "complex.h"
void bit_generator(int (*bit));
void QPSK_modulator(int *(bit), Complex (*signal));
void transmitter(int (*bit), Complex (*signal))
{
bit_generator(bit);
QPSK_modulator(bit, signal);
}
void bit_generator(int (*bit))
{
int n;
for(n=0; n<BITN; n++){
bit[n] = rand() & 0x1;
}
}
void QPSK_modulator(int *(bit),