Philosophaie
Active Member
- Joined
- Mar 5, 2010
- Messages
- 256
Getting an error on the line where you calculate "diff".
I am certain the equations are correct.
E1 is in Radians and MA(k) and EA(k) are in Degrees.
e(k) is no Units.
Error code:
What am I doing wrong?
I am certain the equations are correct.
E1 is in Radians and MA(k) and EA(k) are in Degrees.
e(k) is no Units.
Error code:
Invalid procedure call or argument.
Code:
'Newton Method
Pi = Application.WorksheetFunction.Pi
E1 = Pi / 4 'Initialize
diff = 1 'Initialize
Do Until Math.abs(diff) < 0.00001
If E1 = 3 * Pi / 2 Then
MsgBox ("/0")
E1 = 0.1
End If
diff = (E1 - e(k) * Math.Sin(E1) - MA(k) * Pi / 180) / (1 + Math.Cos(E1)) 'Error
E1 = E1 + diff
Loop
EA(k) = E1 * 180 / Pi
What am I doing wrong?
Last edited: