vb 复数 幅角
已经定于了一个复数类型
- VB code
Public Type Complex x As Double ' 复数实部 y As Double ' 复数虚部End Type
[解决办法]
不知道是不是这个,呵呵
- VB code
Option ExplicitPublic Const e As Double = 2.71828182845905Public Const PI As Double = 3.14159265358979Public Type Complex X As Double ' 复数实部 Y As Double ' 复数虚部End TypePublic Type ComplexZ R As Double '模 Theta As Double '用顺时针为正方向的主幅角End TypePublic Sub CToZ(ByRef C As Complex, ByRef Z As ComplexZ) Z.R = Sqr(C.X ^ 2 + C.Y ^ 2) If C.X <> 0 Then Z.Theta = Abs(Atn(C.Y / C.X)) If C.X > 0 Then If C.Y > 0 Then Z.Theta = Z.Theta Else Z.Theta = 2 * PI - Z.Theta End If Else If C.Y > 0 Then Z.Theta = PI - Z.Theta Else Z.Theta = PI + Z.Theta End If End If Else Z.Theta = 0 End IfEnd SubPublic Sub PrintTheta(Z As ComplexZ) Form1.Print "该复数的幅角为:(" & Z.Theta & "+k*2*pi)弧度(k∈Z)";End Sub