Complex.Phase Egenskap

Definition

Hämtar fasen för ett komplext tal.

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

Egenskapsvärde

Fasen av ett komplext tal, i radianer.

Exempel

I följande exempel används FromPolarCoordinates metoden för att instansiera ett komplext tal baserat på dess polära koordinater och visar sedan värdet för dess Magnitude och Phase egenskaper.

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

Kommentarer

För ett komplext tal a + biberäknas fasen som Atan(b, a).

Du kan identifiera ett komplext tal med dess kartesiska koordinater på det komplexa planet eller med dess polära koordinater. Fasen (argumentet) för ett komplext tal är vinkeln till den verkliga axeln för en linje som dras från ursprungspunkten (skärningspunkten för x-axeln och y-axeln) till den punkt som representeras av det komplexa talet. Magnituden (representeras av Magnitude egenskapen) är avståndet från ursprungspunkten till den punkt som representeras av det komplexa talet.

Du kan instansiera ett komplext tal baserat på dess polära koordinater i stället för dess kartesiska koordinater genom att anropa FromPolarCoordinates metoden.

Om du vill konvertera fasen från radianer till grader multiplicerar du den med $\frac{180}{\pi}$.

Gäller för

Se även