C#将幅度/相位转换为实/虚

joe*_*ish 1 c# math

如果我给了傅里叶变换的极坐标,我想回到笛卡尔(真/虚)坐标,我该怎么做呢?

我可以通过以下代码从笛卡尔坐标系中获取极坐标数字:

    private double GetPhase(double real, double imaginary)
    {
         return Math.Atan2(imaginary, real);
    }

    private double GetMagnitude(double real, double imaginary)
    {
        return Math.Sqrt((real * real) + (imaginary * imaginary));
    }
Run Code Online (Sandbox Code Playgroud)

但是我怎么回去?

Blu*_*kMN 6

不只是:

(伪代码)

x = cos(angle) * magnitude
y = sin(angle) * magnitude
Run Code Online (Sandbox Code Playgroud)

(如果使用计算机的倒置坐标系,请使用负罪)?