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
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,階段會計算為 Math.Atan2 b (,) 。

您可以藉由複數平面上的笛卡兒座標或其極座標來識別複數。 複數的階段 (自變數) 是從原點繪製之線條的實際座標軸的角度, (x 軸的交集以及 Y 軸) 到複數所代表的點。 屬性所表示 Magnitude 的大小 () 是從原點到複數所代表點的距離。

您可以藉由呼叫 FromPolarCoordinates 方法來根據其極座標來具現化複數,而不是其笛卡兒座標。

若要將階段從弧度轉換為度數,請將它乘以 180/Math.PI

適用於

另請參閱