M&M error plot
This commit is contained in:
21
QAM/qam.c
21
QAM/qam.c
@ -364,7 +364,7 @@ void pll(qam_system* qam, double complex* s_with_preamble, double complex* r_cor
|
||||
}
|
||||
|
||||
// Synchro temporelle Müller et Müller
|
||||
void muller_muller_sync(qam_system* qam, double complex* s_data, int nb_symbols, double Kp_mm, double Ki_mm, double complex* r_mm_out) {
|
||||
void muller_muller_sync(qam_system* qam, double complex* s_data, int nb_symbols, double Kp_mm, double Ki_mm, double complex* r_mm_out, FILE* fp_error) {
|
||||
double integrator = 0.0;
|
||||
double timing_offset = 0.0;
|
||||
double current_idx_double = 0.0;
|
||||
@ -411,6 +411,11 @@ void muller_muller_sync(qam_system* qam, double complex* s_data, int nb_symbols,
|
||||
current_idx_double += qam->N - timing_offset;
|
||||
|
||||
d_k_minus_1 = d_k;
|
||||
|
||||
if (fp_error) {
|
||||
fprintf(fp_error, "%d % .8f\n", k, 5 * timing_offset);
|
||||
fflush(fp_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,7 +479,7 @@ int main () {
|
||||
init_constellation(&qam);
|
||||
|
||||
// Conversion du texte en bits
|
||||
char* texte = "Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux";
|
||||
char* texte = "Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux,Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux,Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux,Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux,Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux, Vif juge, trempez ce blond whisky aqueux,FIN";
|
||||
int nb_chars = strlen(texte);
|
||||
int nb_bits = nb_chars * 8;
|
||||
int nb_symbols = (nb_bits + qam.k - 1) / qam.k;
|
||||
@ -530,12 +535,14 @@ int main () {
|
||||
fclose(fp_pll_error);
|
||||
|
||||
double complex* s_bande_base = malloc(sizeof(double complex) * nb_symbols * qam.N);
|
||||
demodulate_carrier(&qam, s_corrected + L * qam.N, s_bande_base, total_samples);
|
||||
demodulate_carrier(&qam, s_corrected + L * qam.N, s_bande_base, nb_symbols * qam.N);
|
||||
|
||||
double complex* r_mm_out = malloc(sizeof(double complex) * nb_bits);
|
||||
double Kp_mm = 0.05;
|
||||
double Ki_mm = 0.001;
|
||||
muller_muller_sync(&qam, s_bande_base, nb_symbols, Kp_mm, Ki_mm, r_mm_out);
|
||||
double complex* r_mm_out = malloc(sizeof(double complex) * nb_symbols);
|
||||
double Kp_mm = 0.5;
|
||||
double Ki_mm = 0.01;
|
||||
FILE *fp_mm_error = fopen("mm_timing_error.dat", "w");
|
||||
muller_muller_sync(&qam, s_bande_base, nb_symbols, Kp_mm, Ki_mm, r_mm_out, fp_mm_error);
|
||||
fclose(fp_mm_error);
|
||||
|
||||
// Démodulation
|
||||
FILE *fp_constel = fopen("constellation.dat", "w");
|
||||
|
||||
Reference in New Issue
Block a user