⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rmtest23.c

📁 快速傅立叶变换程序代码,学信号的同学,可要注意了
💻 C
字号:
/*  RMtest.c  April 1997 DJCM (c)  demonstrates a few uses of RM.c, which   contains routines for creating RM trellises and Hamming too,  and for doing belief propagation on them  the trellis goes from l=0 to N, with   the number of emitted bits being N.   from 0 to 1, bit 1 is emitted.  from N-1 to N, bit N is emitted. */#include "./ansi/r.h"#include "./ansi/rand2.h"#include "./ansi/mynr.h"#include "./ansi/cmatrix.h"#include "./RM.h" void   main ( int , char ** ) ;/*        MAIN                     */void main ( int argc, char *argv[] ){  linear_trellis t ;  int verbosity = 1 ;   int type = 3 ; /* type 1 makes hamming and RM codes; type 0 makes Gallager */  double fn = 0.1 ;   int i ;   int flipone = 1 ;   int testword , testmax = 65 , tmpi , s ;     printf ( "first, let's show a load of trellises\n");  printf ( "============================= M =  23\n");  make_linear_trellis ( &t , 12 , 2 , verbosity ) ;  printf ( "let's check a few codewords\n");  pause_for_return();  for ( testword = 0 ; testword <= testmax ; testword ++ ) {    tmpi = testword ;     for (  i= 1; i<= t.N ; i++ ) {      t.xo[i] = tmpi % 2 ;       tmpi /= 2 ;       printf ( "%d" , ( t.xo[i]? 1:0 ) ) ;     }    s = lt_syndrome ( &t )  ;    printf ( " %3o syndrome is %3o\n" , testword , s ) ;   }  free_linear_trellis ( &t ) ;  printf ( "============================= M =  24\n");  make_linear_trellis ( &t , 24 ,type, verbosity ) ;  free_linear_trellis ( &t ) ;  pause_for_return();  printf ( "============================= shortened hamming\n");  make_linear_trellis ( &t , 12 , 2 , verbosity ) ;  pause_for_return();  printf ( "Now see fb happening, when the received vector looks like 0,0,0,0,0\n");  /* invent a q vector */  for ( i= 1; i<= t.N ; i++ ) {    t.q[i][0] = 1.0 - fn ; t.q[i][1] = fn ;  }  lt_fb ( &t ) ;   pause_for_return();  printf ( "Do it again to check that there is no problem\n");  pause_for_return();  lt_fb ( &t ) ;   pause_for_return();  if ( flipone ) {     printf ( "Now the received vector is (1,0,0,0,0..) \n");    t.q[1][0] = fn ; t.q[1][1] =  1.0 - fn ;     lt_fb ( &t ) ;     pause_for_return();  }  printf ( "Now see fb happening at a sequence of different noise levels\n");  pause_for_return();  for ( fn = 0.04 ; fn <= 0.43 ; fn += 0.04 ) {    printf ("fn = %9.5g ========== \n",fn) ;     for ( i= 1; i<= t.N ; i++ ) {      t.q[i][0] = 1.0 - fn ; t.q[i][1] = fn ;    }    if ( flipone ) { t.q[1][0] = fn ; t.q[1][1] =  1.0 - fn ; }    lt_fb ( &t ) ;     pause_for_return();  }}/*<!-- hhmts start -->Last modified: Tue Nov 21 20:01:32 1995<!-- hhmts end -->*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -