Здравствуйте!
Хочу сделать макрос впервые, но не могу понять куда и что писать.
Есть написанная функция, я ее попробовала вставить, но макрос не работает и выдает ошибку.
Function kepler(m, ecc, eps) ' solves the equation e - ecc*sin(e) = m for e given an m ' returns a value of e given ' m - the 'mean anomaly' in orbit theory ' ecc - the eccentricity of the orbit ' eps - the precision parameter - solution will be ' within 10^-eps of the true value. ' don't set eps above 14, as convergence can't be guaranteed e = m 'first guess delta = 0.05 'set delta equal to a dummy value Do While Abs(delta) >= 10 ^ -eps 'converged? delta = e - ecc * Sin(e) - m 'new error e = e - delta / (1 - ecc * Cos(e)) 'corrected guess Loop kepler = e 'return estimate End Function
Я так понимаю, я что-то не дописала...
Помогите разобраться.
Заранее всем спасибо))
Хочу сделать макрос впервые, но не могу понять куда и что писать.
Есть написанная функция, я ее попробовала вставить, но макрос не работает и выдает ошибку.
Function kepler(m, ecc, eps) ' solves the equation e - ecc*sin(e) = m for e given an m ' returns a value of e given ' m - the 'mean anomaly' in orbit theory ' ecc - the eccentricity of the orbit ' eps - the precision parameter - solution will be ' within 10^-eps of the true value. ' don't set eps above 14, as convergence can't be guaranteed e = m 'first guess delta = 0.05 'set delta equal to a dummy value Do While Abs(delta) >= 10 ^ -eps 'converged? delta = e - ecc * Sin(e) - m 'new error e = e - delta / (1 - ecc * Cos(e)) 'corrected guess Loop kepler = e 'return estimate End Function
Я так понимаю, я что-то не дописала...
Помогите разобраться.
Заранее всем спасибо))