Complex.Phase 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得複數的階段。
public:
property double Phase { double get(); };
public double Phase { get; }
member this.Phase : double
Public ReadOnly Property Phase As Double
屬性值
複數的相位 (以弧度為單位)。
範例
下列範例會 FromPolarCoordinates 使用 方法來根據其極座標具現化複數,然後顯示其 Magnitude 和 Phase 屬性的值。
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,階段會計算為 Math.Atan2 b (,) 。
您可以藉由複數平面上的笛卡兒座標或其極座標來識別複數。 複數的階段 (自變數) 是從原點繪製之線條的實際座標軸的角度, (x 軸的交集以及 Y 軸) 到複數所代表的點。 屬性所表示 Magnitude 的大小 () 是從原點到複數所代表點的距離。
您可以藉由呼叫 FromPolarCoordinates 方法來根據其極座標來具現化複數,而不是其笛卡兒座標。
若要將階段從弧度轉換為度數,請將它乘以 180/Math.PI。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應