[INDENT]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:
QuoteInvalid procedure call or argument.
Code:
Code
'Newton Method
Dim e(1000) As Double, MA(1000) As Double
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 on this line
E1 = E1 + diff
Loop
EA(k) = E1 * 180 / Pi
Display More
What am I doing wrong?[/INDENT]