Attribute VB_Name = "BASIC1"
Function CMult(Z1, Z2)
Attribute CMult.VB_Description = "Multiplies two complex numbers Z1 and Z2. The output is the real and imaginary part of the product"
'Multiplication of the complex number Z1 by complex number Z2
Dim A(2)
A(0) = Z1(1) * Z2(1) - Z1(2) * Z2(2)
A(1) = Z1(1) * Z2(2) + Z2(1) * Z1(2)
CMult = A
End Function
Function CDiv(Z1, Z2)
Attribute CDiv.VB_Description = "Divides the complex number Z1 by complex number Z2. The result is a complex number in cartesian coordinates real and cimaginary parts are written to two adjacent cells\r\n"
Attribute CDiv.VB_HelpID = 1
'Divides the complex number Z1 by complex number Z2
Dim A(2)
Dim Del
Del = Z2(1) ^ 2 + Z2(2) ^ 2
A(0) = (Z1(1) * Z2(1) + Z1(2) * Z2(2)) / Del
A(1) = (Z1(2) * Z2(1) - Z1(1) * Z2(2)) / Del
CDiv = A
End Function
Function CConv(U, Th)
Attribute CConv.VB_Description = "conversion from polar to cartesian form"
'conversion from polar to cartesian form
Dim A(2) As Double
A(0) = U * Cos(Th)
A(1) = U * Sin(Th)
CConv = A
End Function
Function CIConv(Z1)
Attribute CIConv.VB_Description = "Converts the complex number in cartesian form to polar form. The result is the magnitude and angle written at two adjacent cells"
Attribute CIConv.VB_HelpID = 1
Dim A(2) As Double
'Converts the cartesian form of a complex number to polar form
A(0) = Mag(Z1(1), Z1(2))
A(1) = Ang(Z1(1), Z1(2))
CIConv = A
End Function
Function CRotate(Z, beta)
Attribute CRotate.VB_Description = "Rotates the complex number Z by an angle beta about the starting point of the vector Z"
Dim A(2) As Double
'rotates the complex number Z by an angle beta
A(0) = Z(1) * Cos(beta) - Z(2) * Sin(beta)
A(1) = Z(1) * Sin(beta) + Z(2) * Cos(beta)
CRotate = A
End Function
Function CTransform(A, Z, beta)
Attribute CTransform.VB_Description = "Rotates the complex number Z by an angle beta and adds complex number A"
Dim B(2) As Double
'rotates the complex number Z by an angle beta and adds complex number A
B(0) = Z(1) * Cos(beta) - Z(2) * Sin(beta) + A(1)
B(1) = Z(1) * Sin(beta) + Z(2) * Cos(beta) + A(2)
CTransform = B
End Function
Function CMAG2(Z)
Attribute CMAG2.VB_Description = "Determines the magnitude of a complex number Z"
'Determines the magnitude of a complex number Z
CMAG2 = Sqr(Z(1) ^ 2 + Z(2) ^ 2)
End Function
Function Pole(A1x, A1y, Fi1, A2x, A2y, Fi2)
Attribute Pole.VB_Description = "Given the two positions of a moving plane, this program determines the pole on the fixed plane.\r\n'Ajx, Ajy are the coordinates of a point on the moving frame and fij is the angle made by the moving frame w.r to fixed frame at posion j (j=1,2)"
Attribute Pole.VB_HelpID = 1
'Given the two positions of a moving plane, this program determines the pole on the fixed plane.
' Ajx, Ajy are the coordinates of a point on the moving frame and fij is the angle made by the moving frame w.r to fixed frame at posion j (j=1,2,
Dim D, A(2), B1, B2 As Double
D = (Cos(Fi1) - Cos(Fi2)) ^ 2 + (Sin(Fi1) - Sin(Fi2)) ^ 2
B1 = A2x * Cos(Fi1) - A2y * Sin(Fi1) - A1x * Cos(Fi2) + A1y * Sin(Fi2)
B2 = A2y * Cos(Fi1) + A2x * Sin(Fi1) - A1x * Sin(Fi2) - A1y * Cos(Fi2)
A(0) = (B1 * (Cos(Fi1) - Cos(Fi2)) + B2 * (Sin(Fi1) - Sin(Fi2))) / D
A(1) = (B2 * (Cos(Fi1) - Cos(Fi2)) - B1 * (Sin(Fi1) - Sin(Fi2))) / D
Pole = A
End Function
Function Pole2(Q1, Fi1, Q2, Fi2)
Attribute Pole2.VB_Description = "Given the two positions of a moving plane in complex numbers, this program determines the pole on the fixed plane. Q1 and Q2 are complex numbers (vectors) showing the origin of the moving frame at two positions.fi1 and fi2 is the angle between the positive x axes of the moving and fixed coordinates."
Attribute Pole2.VB_HelpID = 1
'Given the two positions of a moving plane, this program determines the pole on the fixed plane.
'Q1 and Q2 are complex numbers (vectors) showing the origin of the moving frame at two positions.fi1 and fi2 is the angle between the positive x axes of the moving and fixed coordinates.
Dim Num(2), Denom(2), A(2), Del
Num(0) = Q1(1) * Cos(Fi2) - Q1(2) * Sin(Fi2) - (Q2(1) * Cos(Fi1) - Q2(2) * Sin(Fi1))
Num(1) = Q1(1) * Sin(Fi2) + Q1(2) * Cos(Fi2) - (Q2(1) * Sin(Fi1) + Q2(2) * Cos(Fi1))
Denom(0) = Cos(Fi2) - Cos(Fi1)
Denom(1) = Sin(Fi2) - Sin(Fi1)
Del = Denom(0) ^ 2 + Denom(1) ^ 2
A(0) = (Num(0) * Denom(0) + Num(1) * Denom(1)) / Del
A(1) = (Num(1) * Denom(0) - Num(0) * Denom(1)) / Del
Pole2 = A
End Function