// ------------------------------------------------------------------------ // File: bound_awgn_ebno.c // // Union bound on the probability of a bit error for a linear code // with soft-decision decoding and binary transmission over an // AWGN channel // ------------------------------------------------------------------------ // This program is complementary material for the book: // // R.H. Morelos-Zaragoza, The Art of Error Correcting Coding, Wiley, 2002. // // ISBN 0471 49581 6 // // This and other programs are available at http://the-art-of-ecc.com // // You may use this program for academic and personal purposes only. // If this program is used to perform simulations whose results are // published in a journal or book, please refer to the book above. // // The use of this program in a commercial product requires explicit // written permission from the author. The author is not responsible or // liable for damage or loss that may be caused by the use of this program. // // Copyright (c) 2002. Robert H. Morelos-Zaragoza. All rights reserved. // ------------------------------------------------------------------------ #include #include #include #include main(argc,argv) int argc; char **argv; { double delta1,delta2,nn,nn2,nn3; int iter,i,i1,j,n,k,k2,k3,dimension,n_max,n_max2,n_max3; double ii1,init,final,inc,eb_no_db,es_no,P1,P2; double sum,sum1,sum2,sum3,aux,beta,rate,c1,jaux,d12; int d_hi[64]; double d_h[64],n_d[64]; int d_hi2[64]; double d_h2[64],n_d2[64]; char name1[40],name2[40]; int d_hi3[64]; double d_h3[64],n_d3[64]; double Q(double a); double erfc( double x ); FILE *fp,*fp1,*fp2,*fp11,*fp22,*fp33; if (argc != 8) { printf("Usage: %s n k wdfile file_bound init_SNR final_SNR inc_SNR\n", argv[0]); exit(1); } sscanf(argv[1], "%d", &n); sscanf(argv[2], "%d", &k); sscanf(argv[3], "%s", name1); sscanf(argv[4], "%s", name2); sscanf(argv[5], "%lf", &init); sscanf(argv[6], "%lf", &final); sscanf(argv[7], "%lf", &inc); rate = (double) k / (double) n; fp1 = fopen(name1,"r"); fp11 = fopen(name2,"w"); n_max = 0; while(fscanf(fp1,"%d %lf\n",&d_hi[n_max],&n_d[n_max])!=EOF) { n_max++; } fclose(fp1); #ifdef DEBUG printf("Weight distribution (scrambled):\n"); for (i=0; i