Complex.Phase 属性

定义

获取复数的阶段。

public:
 property double Phase { double get(); };
public double Phase { get; }
member this.Phase : double
Public ReadOnly Property Phase As Double

属性值

复数的相数(以弧度为单位)。

示例

以下示例使用 FromPolarCoordinates 方法根据其极坐标实例化复数,然后显示其 MagnitudePhase 属性的值。

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex c1 = Complex.FromPolarCoordinates(10, 45 * Math.PI / 180);
      Console.WriteLine("{0}:", c1);
      Console.WriteLine("   Magnitude: {0}", Complex.Abs(c1));
      Console.WriteLine("   Phase:     {0} radians", c1.Phase);
      Console.WriteLine("   Phase      {0} degrees", c1.Phase * 180/Math.PI);
      Console.WriteLine("   Atan(b/a): {0}", Math.Atan(c1.Imaginary/c1.Real));
   }
}
// The example displays the following output:
//       (7.07106781186548, 7.07106781186547):
//          Magnitude: 10
//          Phase:     0.785398163397448 radians
//          Phase      45 degrees
//          Atan(b/a): 0.785398163397448
open System
open System.Numerics

let c1 = Complex.FromPolarCoordinates(10., 45. * Math.PI / 180.)
printfn $"{c1}:"
printfn $"   Magnitude: {Complex.Abs(c1)}"
printfn $"   Phase:     {c1.Phase} radians"
printfn $"   Phase      {c1.Phase * 180. / Math.PI} degrees"
printfn $"   Atan(b/a): {Math.Atan(c1.Imaginary / c1.Real)}"
// The example displays the following output:
//       (7.07106781186548, 7.07106781186547):
//          Magnitude: 10
//          Phase:     0.785398163397448 radians
//          Phase      45 degrees
//          Atan(b/a): 0.785398163397448
Imports System.Numerics

Module Example
   Public Sub Main()
      Dim c1 As Complex = Complex.FromPolarCoordinates(10, 45 * Math.Pi / 180)
      Console.WriteLine("{0}:", c1)
      Console.WriteLine("   Magnitude: {0}", Complex.Abs(c1))
      Console.WriteLine("   Phase:     {0} radians", c1.Phase)
      Console.WriteLine("   Phase      {0} degrees", c1.Phase * 180/Math.Pi)
      Console.WriteLine("   Atan(b/a): {0}", Math.Atan(c1.Imaginary/c1.Real))
   End Sub
End Module
' The example displays the following output:
'       (7.07106781186548, 7.07106781186547):
'          Magnitude: 10
'          Phase:     0.785398163397448 radians
'          Phase      45 degrees
'          Atan(b/a): 0.785398163397448

注解

对于复数 a + bi,该阶段计算为 Atan(b, a)

可以通过复数平面上的笛卡尔坐标或其极坐标来标识复数。 复数的相(参数)是从原点(x 轴和 y 轴的交集)到复数所表示的点的线的实轴的角度。 数量级(由 Magnitude 属性表示)是从起点到由复数表示的点之间的距离。

可以通过调用 FromPolarCoordinates 方法,基于其极坐标而不是笛卡尔坐标来实例化复数。

若要将相位从弧度转换为度,请将其乘以 $\frac{180}{\pi}$。

适用于

另请参阅