Question
I need help Programming this in VBA for Excel Below is the document I have to work with. I have no idea where to even
I need help Programming this in VBA for Excel
Below is the document I have to work with. I have no idea where to even start.
Example 3-7
This example extends Newtons method from your Calculus I class to a real-world orbital mechanics problem. It uses the method to solve Kepler's Equation. Kepler's equation is not one of Kepler's three laws. Kepler's equation relates the satellite's angular position to the time. It's a very common calculation and I imagine that at this instant there are hundreds of computers solving this equation hundreds of times per second. That is because this equation allows you to estimate where a satellite will be in a given (small) amount of time. We are constantly tracking thousands of satellites and Kepler's equation is one of the formulas that can be used to support that tracking.
Unfortunately (or fortunately, as my advisor used to say!) we cannot solve Kepler's equation by hand. It is what math people call transcendental. Here it is: n t = E - e sin (E) Big E and little e are not the same thing. Little e is the eccentricity of the satellite's orbit, a measure of how circular, e = 0, or flattened, e close to 1, the ellipse is. Big E is called the eccentric anomaly and it is shown on the picture above. The satellite's orbit is the black ellipse and the orange circle has radius a, where a is the semi-major axis of the ellipse. The angle from the horizontal axis to the satellite, through the earth, is the true anomaly, Greek letter nu. The two anomalies are not the same but they can be related to each other. n is the mean motion of the satellite. It gives the average angular velocity of the satellite around the earth, so the satellite's period is two*pi divided by n. t is the time that has passed since perigee, the place where the satellite is closest to the earth. The product of n and t is denoted M, the mean anomaly. Using this Kepler's equation becomes: M = E - e sin (E) Here's the problem statement: Given the orbit of the satellite, find the location of the satellite a given time t after perigee. To do this we need to solve Kepler's Equation. We would know M and e and all we would have to do is solve for E, one equation with one unknown. Piece of cake, right?! Think about it, you'll see there is no way to do it by hand. One simple way to solve this problem numerically is with Newton's method. I've included an explanation of Newton's method and a flowchart of the method on another page. In Newton's method, we are solving the problem f(x) = 0. That might not look like our problem but actually all we have to do is put the M on the other side of the equation: f(E) = E - e sin (E) - M Now all we have to do is find the right E by iteration! Newton's method does require the first derivative of f(E) with respect to E: f_prime(E) = 1 - e cos (E) Now we're ready. Here's the program that solves Kepler's Equation given the mean anomaly and the eccentricity. Notice how I use the simple DO loop with three different exit statements.
(C++ Program supplied below) **Note: I NEED TO PROGRAM THIS IN VBA
#include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started