Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program to Calculate Ellipse Aspect Ratio 1

Status
Not open for further replies.

Gart888

Mechanical
Oct 18, 2006
6
I am working with a large data set of vertical and horizontal velocities. When I plot these velocities, they form an ellipse.

I am required to write a program that will determine the b/a ratio of these ellipses.

It will be easy to determine the length of the major axis... simply the hypotenuse of the triangle connecting the max. and min. points of the ellipse in both directions. But i am having difficulty in comming up with an algorith to determine the length of the minor axis of the ellipse.

Any input or ideas on how to do this would be greatly appreciated.

Thanks!
 
Replies continue below

Recommended for you

Your continued donations keep Wikipedia running!
Ellipse
From Wikipedia, the free encyclopedia
Jump to: navigation, search
"Elliptical" redirects here. For the exercise machine, see Elliptical trainer.
For other uses, see Ellipse (disambiguation).
The ellipse and some of its mathematical properties.
The ellipse and some of its mathematical properties.

In mathematics, an ellipse (from the Greek for absence) is the locus of points on a plane where the sum of the distances from any point on the curve to two fixed points is constant. The two fixed points are called foci (plural of focus).

An ellipse is a type of conic section: if a conical surface is cut with a plane which does not intersect the cone's base, the intersection of the cone and plane is an ellipse. For a short elementary proof of this, see Dandelin spheres.

Algebraically, an ellipse is a curve in the Cartesian plane defined by an equation of the form

Ax2 + Bxy + Cy2 + Dx + Ey + F = 0

such that B2 < 4AC, where all of the coefficients are real, and where more than one solution, defining a pair of points (x, y) on the ellipse, exists.

An ellipse can be drawn with two pins, a loop of string, and a pencil. The pins are placed at the foci and the pins and pencil are enclosed inside the string. The pencil is placed on the paper inside the string, so the string is taut. The string will form a triangle. If the pencil is moved around so that the string stays taut, the sum of the distances from the pencil to the pins will remain constant, satisfying the definition of an ellipse.

The line segment AB, that passes through the foci and terminates on the ellipse, is called the major axis. The major axis is the longest segment that can be obtained by joining two points on the ellipse. The line segment CD, which passes through the center (halfway between the foci), perpendicular to the major axis, and terminates on the ellipse, is called the minor axis. The semimajor axis (denoted by a in the figure) is one half the major axis: the line segment from the center, through a focus, and to the edge of the ellipse. Likewise, the semiminor axis (denoted by b in the figure) is one half the minor axis.

If the two foci coincide, then the ellipse is a circle; in other words, a circle is a special case of an ellipse, one where the eccentricity is zero.

An ellipse centered at the origin can be viewed as the image of the unit circle under a linear map associated with a symmetric matrix A = PDPT, D being a diagonal matrix with the eigenvalues of A, both of which are real positive, along the main diagonal, and P being a real unitary matrix having as columns the eigenvectors of A. Then the axes of the ellipse will lie along the eigenvectors of A, and the eigenvalues are the lengths of the semimajor and semiminor axes.

An ellipse can be produced by multiplying the x coordinates of all points on a circle by a constant, without changing the y coordinates.
Contents
[hide]

* 1 Eccentricity
* 2 Equations
* 3 Semi-latus rectum and polar coordinates
* 4 Area
* 5 Circumference
* 6 Stretching and projection
* 7 Reflection property
* 8 Ellipses in physics
* 9 Ellipses in computer graphics
* 10 See also
* 11 References
* 12 External links

[edit] Eccentricity

The shape of an ellipse can be expressed by a number called the eccentricity of the ellipse, conventionally denoted \, \varepsilon. The eccentricity is a positive number less than 1 and greater than or equal to 0. An eccentricity of 0 implies that the two foci occupy the same point and that the ellipse is a circle.

For an ellipse with semimajor axis a and semiminor axis b, the eccentricity is

\varepsilon = \sqrt{1 - \frac{b^2}{a^2}}.

The greater the eccentricity is, the larger the ratio of a to b, and therefore the more elongated is the ellipse.

If c equals the distance from the center to either focus, then

\varepsilon = \frac{c}{a}.

The distance c is known as the linear eccentricity of the ellipse. The distance between the foci is 2a?.

[edit] Equations

An ellipse centered at the point (h,k) and having its major axis parallel to the x-axis may be specified by the equation

\frac{(x-h)^{2}}{a^{2}} + \frac{(y-k)^{2}}{b^{2}} = 1.

This ellipse can be expressed parametrically as

x = h+a\,\cos t,\,\!
y = k+b\,\sin t\,\!

where t may be restricted to the interval -\pi\leq t \leq \pi\,\!.

If h = 0 and k = 0 (i.e., if the center is the origin (0,0)), then we can express this ellipse in polar coordinates by the equation

r = \frac{ab}{\sqrt{a^2 \sin^2 \theta + b^2 \cos^2 \theta}}=\frac{b}{\sqrt{1-\varepsilon^2 \cos^2 \theta}}

where \varepsilon is the eccentricity of the ellipse.

With one focus at the origin, the ellipse's polar equation is

r = \frac{ a\cdot(1-\varepsilon^{2})}{1 + \varepsilon\cdot\cos\theta}.

A Gauss-mapped form:

\left(\frac{a\cos\beta}{\sqrt{a^2\cos^2\beta+b^2\sin^2\beta}},\frac{b\sin\beta}{\sqrt{a^2\cos^2\beta+b^2\sin^2\beta}}\right)

has normal (cos?,sin?).

[edit] Semi-latus rectum and polar coordinates

The semi-latus rectum of an ellipse, usually denoted l\,\! (lowercase L), is the distance from a focus of the ellipse to the ellipse itself, measured along a line perpendicular to the major axis. It is related to a\,\! and b\,\! (the ellipse's semi-axes) by the formula al=b^2\,\! or, if using the eccentricity, l=a\cdot(1-\varepsilon^2)\,\!.
Ellipse, showing semi-latus rectum

In polar coordinates, an ellipse with one focus at the origin and the other on the negative x-axis is given by the equation

r\cdot(1 + \varepsilon\cdot \cos \theta) = l \,\!

An ellipse can also be thought of as a projection of a circle: a circle on a plane at angle ? to the horizontal projected vertically onto a horizontal plane gives an ellipse of eccentricity sin ?, provided ? is not 90°.

[edit] Area

The area enclosed by an ellipse is ?ab, where 'a' and 'b' are the semimajor and semiminor axes. In the case of a circle where a = b, the expression reduces to the familiar ?a2.

[edit] Circumference

The circumference of an ellipse is 4 a E(\varepsilon), where the function E is the complete elliptic integral of the second kind.

The exact infinite series is:

C = 2\pi a \left[{1 - \left({1\over 2}\right)^2\varepsilon^2 - \left({1\cdot 3\over 2\cdot 4}\right)^2{\varepsilon^4\over 3} - \left({1\cdot 3\cdot 5\over 2\cdot 4\cdot 6}\right)^2{\varepsilon^6\over5} - \dots}\right]\!\,

Or:

C = 2\pi a \sum_{n=0}^\infty {\left\lbrace - \left[\prod_{m=1}^n \left({ 2m-1 \over 2m}\right)\right]^2 {\varepsilon^{2n}\over 2n - 1}\right\rbrace}

A good approximation is Ramanujan's:

C \approx \pi \left[3(a+b) - \sqrt{(3a+b)(a+3b)}\right]\!\,

which can also be written as:

C \approx \pi a \left[ 3 (1+\sqrt{1-\varepsilon^2}) - \sqrt{(3+ \sqrt{1-\varepsilon^2})(1+3 \sqrt{1-\varepsilon^2})} \right] \!\,

For the special case where the minor axis is half the major axis, we get:

C \approx \pi a (9 - \sqrt{35})/2 \!\,

More generally, the arc length of a portion of the circumference, as a function of the angle subtended, is given by an incomplete elliptic integral. The inverse function, the angle subtended as a function of the arc length, is given by the elliptic functions.

[edit] Stretching and projection

An ellipse may be uniformly stretched along any axis, in or out of the plane of the ellipse, and it will still be an ellipse. The stretched ellipse will have different properties (perhaps changed eccentricity and semi-major axis length, for instance), but it will still be an ellipse (or a degenerate ellipse: a circle or a line). Similarly, any oblique projection onto a plane results in a conic section. If the projection is a closed curve on the plane, then the curve is an ellipse or a degenerate ellipse.

[edit] Reflection property

Assume an elliptic mirror with a light source at one of the foci. Then all rays are reflected to a single point — the second focus. Since no other curve has such a property, it can be used as an alternative definition of an ellipse.

Sound waves are reflected in a similar way, so in a large elliptical room a person standing at one focus can hear a person standing at another focus remarkably well. Such a room is called a whisper chamber. Examples are the National Statuary Hall Collection at the U.S. Capitol (where John Quincy Adams is said to have used this property for eavesdropping on political matters), at an exhibit on sound at the Museum of Science and Industry in Chicago, in front of the University of Illinois at Urbana-Champaign Foellinger Auditorium, and also at a side chamber of the Palace of Charles V, in the Alhambra.

[edit] Ellipses in physics

In the 5th century, Aryabhata made the discovery that the planets follow elliptical orbits[1] around the Sun.[2] He published his elliptical heliocentric model[3] in the Aryabhatiya in 499.

In the 11th century, Abu al-Rayhan al-Biruni observed that the planets revolved in elliptical orbits, instead of the circular orbits of the ancient Greeks. He published his observations in his Kitab al-qanun al-Mas’udi in 1031, which was later translated into Latin as Canon Mas’udicus. A contemporary, Al-Zarqali, later known as Arzachel in Latin, stated that the planets moved in ellipses with the Sun at one focus.[4] Later in the 13th century, Nasir al-Din al-Tusi developed a planetary model in which the planets followed elliptical orbits.[5]

In the 17th century, Johannes Kepler explained that the orbits along which the planets travel around the Sun are ellipses in his first law of planetary motion. Later, Isaac Newton explained this as a corollary of his law of universal gravitation.

More generally, in the gravitational two-body problem, if the two bodies are bound to each other (i.e., the total energy is negative), their orbits are similar ellipses with the common barycenter being one of the foci of each ellipse. Interestingly, the orbit of either body in the reference frame of the other is also an ellipse, with the other body at one focus.

The general solution for a harmonic oscillator in two or more dimensions is also an ellipse, but this time with the origin of the force located at the center of the ellipse.

Albert Einstein also used the ellipse to prove his theory of relativity by using an elliptical shaped mass.

[edit] Ellipses in computer graphics

Drawing an ellipse is a common graphics primitive in standard display libraries, such as the Macintosh QuickDraw API and the Windows Graphics Device Interface (GDI). Often such libraries are limited and can only draw an ellipse with either the major axis or the minor axis horizontal. Jack Bresenham at IBM is most famous for the invention of 2D drawing primitives, including line and circle drawing, using only fast integer operations such as addition and branch on carry bit. An efficient generalization to draw ellipses was invented in 1984 by Jerry Van Aken (IEEE CG&A, Sept. 1984).

[edit] See also

* Ellipsoid, a higher dimensional analog of an ellipse
* Spheroid, the ellipsoids obtained by rotating an ellipse about its major or minor axis.
* Super ellipse, a generalization of an ellipse that can look more rectangular
* Hyperbola
* Parabola
* Orbit
* Oval (geometry)
* True, eccentric, and mean anomalies
* Matrix representation of conic sections
* Kepler's Laws of Planetary Motion

[edit] References

1. ^ J. J. O'Connor and E. F. Robertson, Aryabhata the Elder, MacTutor History of Mathematics archive:

"He believes that the Moon and planets shine by reflected sunlight, incredibly he believes that the orbits of the planets are ellipses."

2. ^ Ragep, J. (2002). Ancient Roots of Modern Science, Talk of the Nation.
3. ^ Teresi, Dick (2002). Lost Discoveries: The Ancient Roots of Modern Science - from the Babylonians to the Maya. Simon & Schuster, New York. ISBN 0-684-83718-8.
4. ^ Asghar Qadir (1989). Relativity: An Introduction to the Special Theory, p. 6-11. World Scientific, Singapore. ISBN 9971506122.
5. ^ Covington, Richard (May-June 2007). "Rediscovering Arabic science", Saudi Aramco World, p. 2-16.

[edit] External links

* Ellipse & Hyperbola Construction - An interactive sketch showing how to trace the curves of the ellipse and hyperbola. (Requires Java.)
* Ellipse Construction - Another interactive sketch, this time showing a different method of tracing the ellipse. (Requires Java.)
* Ellipse on MathWorld - More on Ellipse
* The Shape and History of The Ellipse in Washington, D.C. by Clark Kimberling
* Collection of animated ellipse demonstrations. Ellipse, axes, semi-axes, area, perimeter, tangent, foci.
* Woodworking videos showing how to work with ellipses in wood.

Wikimedia Commons has media related to:
Ellipses
Retrieved from "
Category: Conic sections
Views

* Article
* Discussion
* Edit this page
* History

Personal tools

* Sign in / create account

Navigation

* Main page
* Contents
* Featured content
* Current events
* Random article

interaction

* About Wikipedia
* Community portal
* Recent changes
* Upload file
* Contact us
* Make a donation
* Help

Search

Toolbox

* What links here
* Related changes
* Upload file
* Special pages
* Printable version
* Permanent link
* Cite this article

In other languages

* Afrikaans
* ???????
* Asturianu
* ?????????
* Català
* ?esky
* Dansk
* Deutsch
* ????????
* Español
* Esperanto
* Français
* Galego
* Hrvatski
* ???
* Bahasa Indonesia
* Interlingua
* Italiano
* ?????
* ???????
* Latviešu
* Lietuvi?
* Magyar
* Nederlands
* ???
* ?Norsk (bokmål)?
* ?Norsk (nynorsk)?
* Polski
* Português
* Runa Simi
* Român?
* ???????
* Sicilianu
* Simple English
* Sloven?ina
* Slovenš?ina
* Suomi
* ?????? / Srpski
* Svenska
* ?????
* Türkçe
* ??????????
* Ti?ng Vi?t
* ??

Powered by MediaWiki
Wikimedia Foundation

* This page was last modified 15:11, 17 May 2007.
* All text is available under the terms of the GNU Free Documentation License. (See Copyrights for details.)
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a US-registered 501(c)(3) tax-deductible nonprofit charity.
* Privacy policy
* About Wikipedia
* Disclaimers
 
RWF7437 - I'm not sure if you are trying to point me in the direction, or simply shame me. But in either case, yes, i read the wikipedia antry for ellipse before posting this question.

Right now i'm thinking that the best way to go about this program would be to tilt the ellipse so that the major axis runs parallel to the x axis. This will make it very easy to calculate both the maor and minor axes of the ellipse.

Any insight on a code for rotating an ellipse?
 
Just trying to point you to the basic equations for an ellipse. Your question is posted in the statistics forum but it seems to me your question might get better responses in either the computer topics forum or the spreadsheet forum. I am not a programmer so I can't give you detailed answers but your suggestion to rotate the axes would probably simplify the problem, I think.

There are some pretty smart programmers on those fora.

good luck
 
Your question as posed doesn't seem to make sense. If you can find the max and min in one direction, what's stopping you from finding the max and min in the other direction? Wouldn't you simply trade variables?

TTFN

FAQ731-376


 
You state that "It will be easy to determine the length of the major axis... simply the hypotenuse of the triangle connecting the max. and min. points of the ellipse in both directions." Perhaps I am misunderstanding you, but I am not at all sure that this statement is correct.

In trying to fit an ellipse to a dataset, you have five degrees of freedom: the centrepoint of the ellipse (2 dof); the semiaxes (2 dof); and the orientation of the ellipse (1 dof). If I was presented with this problem, I would get the data into Excel, and set up a very approximate "ellipse of best fit" based on five cells containing these five degrees of freedom. I would then try to come up with some sort of measure of the total error associated with my approximate solution (not a trivial task in the case of an ellipse). Having done that, I would then use Excel's "Solver" to adjust the five degrees of freedom so as to minimise the error.
 
Why do "you" have to write a program to do this? Doesn't something like this already exist?
 
"I" have to write the program to do this because the aspect ratio is only one part of the analysis that we are performing. I now have a program that will read in a data set and spit out a series of different usefull characteristics that i can use to track different trends.

Thanks for the help everyone... problem solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor