Kepler's First law Polar to Cartesian

In summary, you need to separately plot the square roots of your equation in order to get the ellipse in Cartesian form.
  • #1
Jman2150
2
0
Forgive me if this is in the wrong thread I'm new here.

I am trying to plot an orbit in MatLab using Kepler's First law of motion. In polar form it works fine r(θ) = h^2/μ*(1/(1+e*cos(θ)))

h = angular momentum μ = standard gravitational constant and e = eccentricity.

The problem is I'd like to have everything in Cartesian coordinates and I can't seem to get the conversion correct.

I thought it would just be the equation for an ellipse (x/a)^2+(y/b)^2=1 but that doesn't give me the right shape for some reason.

So if someone knows the direct conversion of Kepler's first law from polar to Cartesian coordinates I would very much appreciate the help.
 
Science news on Phys.org
  • #2
Jman2150 said:
Forgive me if this is in the wrong thread I'm new here.

I am trying to plot an orbit in MatLab using Kepler's First law of motion. In polar form it works fine r(θ) = h^2/μ*(1/(1+e*cos(θ)))

h = angular momentum μ = standard gravitational constant and e = eccentricity.

The problem is I'd like to have everything in Cartesian coordinates and I can't seem to get the conversion correct.

I thought it would just be the equation for an ellipse (x/a)^2+(y/b)^2=1 but that doesn't give me the right shape for some reason.

What exactly do you mean by "doesn't give me the right shape?" What does it end up looking like?

There are a couple of things that could be a problem here. If you solve your cartesian equation for y so that you can plot it vs. x, you are going to get a square root. You need to separately plot both the positive and negative square roots in order to get both halves of the ellipse.

Another problem could be that the equation of the ellipse in polar form that you have is for an ellipse for which one focus is at the origin. In contrast, the equation for the ellipse in Cartesian coordinates that you have is for an ellipse whose centre is at the origin. I'm not sure if this shift is causing you difficulties.
 
  • #3
Another thing is that it is a really straightforward conversion from your equation in polar form to one in Cartesian form. It's always true that x = rcosθ. Or cosθ = x/r So, you have that[tex] r \propto \frac{1}{1 + ex/r}[/tex]I find that if you just rearrange to solve for r, and then plug in [tex] r = \sqrt{x^2 + y^2}[/tex] which is also always true, you get an equation for the same ellipse, with the correct shift relative to the origin.
 
  • #4
Cepheid,

Thanks man. Turns out that it was because my Cartesian ellipse was centered at the origin. I made the correction and it works fine now.

Appreciate the help.
 
  • #5


I would like to commend you for using Kepler's First Law of Motion to plot an orbit in MatLab. It is a fundamental law that has been instrumental in our understanding of planetary motion.

To convert from polar to Cartesian coordinates, you can use the following equations:

x = r*cos(θ)

y = r*sin(θ)

where r is the distance from the focus to the orbiting object (or planet), and θ is the angle between the focus and the position of the object.

In this case, your equation in Cartesian coordinates would be:

x = h^2*cos(θ)/(μ*(1+e*cos(θ)))

y = h^2*sin(θ)/(μ*(1+e*cos(θ)))

As you can see, this is not a simple ellipse equation, as the distance (r) and angle (θ) are not constant in an elliptical orbit. The eccentricity (e) also plays a role in determining the shape of the orbit.

I hope this helps in your plotting and understanding of Kepler's First Law in Cartesian coordinates. Keep exploring and experimenting, and best of luck with your project!
 

What is Kepler's First Law?

Kepler's First Law, also known as the Law of Ellipses, states that the orbit of a planet around the sun is in the shape of an ellipse with the sun at one of the two foci.

What is the significance of Kepler's First Law?

Kepler's First Law was a major advancement in our understanding of planetary motion and helped to disprove the previously held belief that the Earth was the center of the universe.

What is the difference between a polar and Cartesian coordinate system?

A polar coordinate system uses an angle and a distance from the origin to locate a point, while a Cartesian coordinate system uses an x and y coordinate to locate a point on a grid.

How does Kepler's First Law relate to polar and Cartesian coordinates?

Kepler's First Law can be expressed in both polar and Cartesian coordinates, with the focus of the ellipse being located at the origin in polar coordinates and at one of the foci in Cartesian coordinates.

What is the formula for converting from polar to Cartesian coordinates?

The formula for converting from polar to Cartesian coordinates is x = r * cos(theta) and y = r * sin(theta), where r is the distance from the origin and theta is the angle in radians.

Similar threads

  • Thermodynamics
Replies
9
Views
1K
Replies
3
Views
5K
  • Differential Equations
Replies
15
Views
2K
  • Classical Physics
Replies
4
Views
795
  • Astronomy and Astrophysics
Replies
5
Views
1K
Replies
2
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
  • Classical Physics
Replies
1
Views
797
Replies
4
Views
999
  • General Math
Replies
7
Views
1K
Back
Top