phase_drift.c

来自「基于wimax中ofdm在vxworks的仿真代码」· C语言 代码 · 共 42 行

C
42
字号
/*****************************************************************************//*   FIle Name : phase_drift.c                                               *//*   Description : Wi-Max OFDM correct phase_drift error in time domain      *//*                 phase & amount : radian                                   *//*   author : miffie                                                         *//*   Date   : Nov/04/05                                                      *//*   Copyright (c) 2005 miffie   All rights reserved.                        *//*****************************************************************************/struct complexset phase_drift (struct complexset datain,                           double *phase, double *amount ) {int 	ii ;char 	shifter ;double 	accumulator ;struct 	complexset cset ;struct  complex  *top ;struct	complex tmp1 ;double  angle ;  //Main     if ((top = (struct complex *)malloc(datain.size*sizeof(struct complex)) ) == NULL) {        PRINTF( " malloc failed in phase_drift.c\n") ;    } //fail    else { //allocated     PRINTF("phase_drift size=%d phase=%6.3f amount=%8.5f\n", datain.size,                                  *phase, *amount ) ;     accumulator = *phase ;     for(ii=0;ii<datain.size;ii++) { //each sample         tmp1.realp = cos(accumulator) ;         tmp1.image = sin(accumulator) ;         top[ ii ] = multiply_complex(datain.data[ii], tmp1 ) ;         accumulator += *amount ;     } //each sample     cset.size = datain.size ;     cset.data = top ;    }//allocated    *phase = accumulator ;    free ( datain.data ) ;    return ( cset ) ;} //phase_drift

⌨️ 快捷键说明

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