📄 complex_math.c
字号:
//complex_math.c
//
// Project Red 2002: High Performance OFDM Modem
// Against Channel Imperfections
// Auther: Linus Falk
//calculates the complex multiplication, returns in xy.
void complex_multiplication(float xy[2], float ab[2]){
float re = 0;
float im = 0;
re = xy[0]*ab[0] - xy[1]*ab[1];
im = xy[1]*ab[0] + xy[0]*ab[1];
xy[0] = re;
xy[1] = im;
}
//calculates the complex division, returns in xy;
void complex_division(float xy[2], float ab[2]){
float div_factor = 0;
div_factor = _rcpsp(ab[0]*ab[0] + ab[1]*ab[1]);
ab[1] *= -1; // conjugate
complex_multiplication(xy,ab);
ab[1] *= -1; // conjugate back
xy[0] *= div_factor;
xy[1] *= div_factor;
}
//calculates |xy|^2, returns in value
void complex_abs_sqr(float xy[2], float *value){
*value = xy[0]*xy[0] + xy[1]*xy[1];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -