This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AOA角度计算问题

在simplelink_cc2640r2_sdk_2_30_00_28 版本中,aoa receiver 将接收到的I\Q 值,通过如下函数计算得到角度。

我的问题是,如下代码中,计算 天线1和天线2的相位差用到如下方法,分别传入a,b天线采集的I\Q值

  // Calculate phase difference between antenna a vs. antenna b
                int16_t Pab_rel = AngleComplexProductComp(

sample[r*numAnt*AOA_NUM_SAMPLES_PER_BLOCK + a*AOA_NUM_SAMPLES_PER_BLOCK + i].i,

sample[r*numAnt*AOA_NUM_SAMPLES_PER_BLOCK + a*AOA_NUM_SAMPLES_PER_BLOCK + i].q,

sample[r*numAnt*AOA_NUM_SAMPLES_PER_BLOCK + b*AOA_NUM_SAMPLES_PER_BLOCK + i].i,

sample[r*numAnt*AOA_NUM_SAMPLES_PER_BLOCK + b*AOA_NUM_SAMPLES_PER_BLOCK + i].q);

在如下函数中,红色,蓝色部分代码如此运算的目和原理是什么?

// Example code for processing IQ data
int16_t AngleComplexProductComp(int16_t Xre, int16_t Xim, int16_t Yre, int16_t Yim)
{
    int32_t Zre, Zim;
    int16_t angle;

    // X*conj(Y)
    Zre = Xre*Yre + Xim*Yim;
    Zim = Xim*Yre - Xre*Yim;
    Zre >>= 10;
    Zim >>= 10;

    // Angle. The angle is returned in 256/2*pi format [-128,127] values
    angle = iatan2sc((int16_t) Zim, (int16_t) Zre);

    return (angle * angleconst);
}