📄 mimo_dfe.c
字号:
/*****************************************************************************//* FIle Name : mimo_dfe.c *//* Description : MIMO prototype Decision Feedback Equalizer for MIMO *//* author : miffie *//* Date : oct/28/05 *//* Copyright (c) 2005 miffie All rights reserved. *//*****************************************************************************/struct complexsetset mimo_dfe(struct complexsetset css , char num_out ) { //mimo_dfeint ii, jj, kk ;int size , offset ;struct complexset *ctop ;struct complexset cset0 ;struct complexsetset cout ;struct complex yy , tmp1, error ;struct complex coef[8] ;struct complex *top ;double mu = 2.0 ;static double short_realp[] = { 0.046 , -0.132 , -0.013 , 0.143, 0.092 , 0.143 , -0.013 , -0.132, 0.046 , 0.002 , -0.079 , -0.013, 0.000 , -0.013 , -0.079 , 0.002 } ;static double short_image[] = { 0.046 , 0.002 , -0.079 , -0.013, 0.000 , -0.013 , -0.079 , 0.002, 0.046 , -0.132 , -0.013 , 0.143, 0.092 , 0.143 , -0.013 , -0.132 } ; if((ctop = (struct complexset *)malloc(num_out*sizeof(struct complexset)) ) == NULL) { PRINTF( " malloc failed in mimo_dfe.c\n") ; } //fail else { //allocated size = css.set[0].size ; cout.size = num_out ; cout.set = ctop ; PRINTF("mimo_dfe num_out=%d size=%d\n", num_out, size ) ; for(kk=0;kk<num_out;kk++) { //each transmitter if ((top = (struct complex *)malloc(size*sizeof(struct complex)) ) == NULL) { PRINTF( " malloc failed in mimo_dfe.c\n") ; } //fail else { //allocated ctop[kk].data = top ; ctop[kk].size = size-8 ; //initialize coeffcients for(jj=0;jj<css.size;jj++) { coef[jj].realp = 0 ; coef[jj].image = 0 ; } offset = kk * 2 ; for(ii=0;ii<(size-8);ii++) { //each sample yy.realp = 0 ; yy.image = 0 ; for(jj=0;jj<css.size;jj++) { //each receiver //printf("data(%d %d) r=%6.3f i=%6.3f\n", ii, jj, css.set[jj].data[ii+offset].realp, // css.set[jj].data[ii+offset].image ) ; tmp1 = multiply_complex(coef[jj] ,css.set[jj].data[ii+offset]) ; yy.realp += tmp1.realp ; yy.image += tmp1.image ; } //each receiver //Output top[ii].realp = yy.realp ; top[ii].image = yy.image ; printf("yy(%d) r=%6.3f i=%6.3f\n", ii, yy.realp, yy.image) ; if(ii<160) { //training mode // mu = (ii<60) ? 8.0 : 1.0 ; //Compare SHORT Sequence //Error printf("exp(%d) r=%6.3f i=%6.3f\n", ii, short_realp[ ii %16 ], short_image[ ii %16 ] ) ; error.realp = (short_realp[ ii %16 ] - yy.realp)*mu ; error.image = (short_image[ ii %16 ] - yy.image)*mu ; //printf("error(%d) r=%6.3f i=%6.3f\n", ii, error.realp, error.image) ; //Coef for the next cycles for(jj=0;jj<css.size;jj++) { //each receiver tmp1.realp = css.set[jj].data[ii+offset].realp ; tmp1.image = -css.set[jj].data[ii+offset].image ; tmp1 = multiply_complex(error, tmp1 ) ; coef[jj].realp += tmp1.realp ; coef[jj].image += tmp1.image ; printf("coef(%d %d) %6.3f + j * %6.3f\n",ii, jj, coef[jj].realp, coef[jj].image) ; } //each receiver } //training mode } //each sample } //allocated } //each transmitter } //allocated return( cout ) ;}//mimo_dfe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -