Formulas for ellipse at an angle, in Excel.

In summary, the goal of this conversation was to figure out a way to rotate an ellipse in Excel. The person gave a canonical form for an ellipse and explained that it is easier to use a parametric description of the ellipse. The person then gave a formula to calculate points in Excel, and explained that if t is rotated with respect to x and y, then y would be rotated with respect to b and cosine of t. The person then gave a formula to rotate the ellipse 90 degrees, and explained that the ellipse should "stand up"
  • #1
Thorvald
32
0
Hi.

I know about the general formula for an ellipse: x^2/a^2 + y^2/b^2 = 1, that can be used to isolate y and calculate x,y points in excel. That's great, so far so good. That will create a ellipse, with horizontal A (x) axis and vertical B (y) axis. But what if one wants to rotate the ellipse some amount of degrees, like 20 degrees, 60 degrees - in Excel?? Is there a simple way to do that in Excel - or to apply that to the general formula for the ellipse? Maybe I am thinking too complicated, so that I can't see the solution... :smile:
 
Engineering news on Phys.org
  • #2
Take your result and x and y values, and run them through a simple rotation matrix. In 2D is should be fairly straightforward.
http://en.wikipedia.org/wiki/Rotation_matrix

Might be a difficult way to get it in closed form within your ellipse function, but as a two-step process, should be pretty easy.
 
  • #3
Thorvald said:
I know about the general formula for an ellipse: x^2/a^2 + y^2/b^2 = 1
That is not the general formula for an ellipse. A general formula would describe all ellipses. The given expression is a canonical form, not a general form.

For plotting some curve it is often easier to use a parametric description of the curve. One parametric description of that canonical ellipse is

[tex]\begin{align*}
x &= b\cos t \\
y &= a \sin t
\end{align*}
[/tex]

This parametric description is very easy to implement in Excel. Let column A be used for t, column B for x, and column C for y. Make column A, the t values, march from 0 to 2*pi in uniform steps. Columns B and C are the simple expressions b*cos(t) and a*sin(t), where t is the column A value for the row in question.

Suppose instead these x and y values are for some axes rotated with respect to the x and y axes. Label columns B and C u and v instead of x and y. Add two more columns to denote x and y. The x value is u*cos(theta)-v*sin(theta) while y is u*sin(theta)+v*cos(theta), where theta is some defined value (just as are a and b).
 
  • #4
Hmmm., thanks for your replies - very useful. I have used this formula to calculate points (or at least the 1/4th of the ellipse) in excel: y = sqrt(b^2*(1-x^2/a^2), where I choose values for a and b. Does your formula y = b cos(t), give the same result (possibly giving the whole ellipse)? And t is angles from 0 to 360 degrees?? That formula for y is of course easier, but my first formula is now programmed in Excel and works - so maybe I just keep it.

Then to rotate it, it seems like you both agree that the new formula for y would be:

y' = x sin(t) + y cos(t)

This I could simply add in a column after my present x, y columns, to achieve the same ellipse, just rotated t degrees - (I think). Is that a correct understanding of it? Must try it out when I get some time... :)
 
  • #5
Does this look correct? It does not look like the curve have been rotated 45 degrees?

I may want to use the formulas for creating the whole ellipse and then just take out what part of the ellipse, I want to use. But this was just for now to see if it works.

Ellipsecalculation.jpg
 
  • #6
It looks OK, but just to check, it might help to define your rotation angle as 90°. So, you're point at (0,145) should go to (-145,0). Do each step separately just to make sure everything is cool.
 
  • #7
You're right - it looks ok. I know why it didn't look exactly correct - because as values changes the axes in the graph changes... Is it possible to automatically control the graph grid, so it is the same in the different pictures?

Ellipsecalculationtest1.jpg


Ellipsecalculationtest2.jpg


Ellipsecalculationtest3.jpg
 
  • #8
Hmmm., wait - when I rotate the ellipse 90 degrees, I would expect that it would "stand up". I.e. the long part of ellipse, being vertical. Why that is not the case?
 
  • #9
Aaaah - wait again - it may be the case, it's just the grid/axes that teases me...
 
  • #10
D H said:
...that canonical ellipse is

[tex]\begin{align*}
x &= b\cos t \\
y &= a \sin t
\end{align*}
[/tex]

It looks like you have made a mistake here. I couldn't understand why, when I used this formula the "a" was smaller than the "b" - but it's logic, because a is the biggest value along the x-axis, so "a" should be in the formula for x.
 
Last edited:
  • #11
How to rotate the ellipse in the point (0,-b)?? The formulas you have given, rotates it around (0,0). I'd like to move the ellipse (shouldn't be difficult), use part of the ellipse (not difficult, either) and then rotate it at what was originally (0,-b).
 
  • #12
Thorvald said:
How to rotate the ellipse in the point (0,-b)?? The formulas you have given, rotates it around (0,0). I'd like to move the ellipse (shouldn't be difficult), use part of the ellipse (not difficult, either) and then rotate it at what was originally (0,-b).
(1) First figure out where the origin rotates to, if you rotate by an angle θ about the point (0,-b). Maybe the easiest way to do this is to rotate the point (0,-b) about the origin by θ, figure out it's displacement, and realize that the origin will by displaced that amount in the opposite direction when rotated by θ about (0,-b)

(2) Next rotate the ellipse by θ about the origin, just as before.

(3) Finally, apply the displacement that you determined in step (1) to the entire ellipse.

By the way, if you parameterize the initial (unrotated) ellipse as was suggested before:
x = a cos(t) (yes, you're correct, a goes with x)
y = [STRIKE] b cos(t) [/STRIKE] EDIT -- oops, that should be: b sin(t)​
Then I think you're ellipse could look a lot nicer, especially near the vertices. Just be aware that Excel assumes radians when doing trig functions, so:
0 ≤ t ≤ 2*pi​

Also, you might want to set your axis scales to fixed values, so that you are not dealing the the autoscaling issues whenever you move the ellipse.

Final piece of advice: I like to give Excel graphs a white background. Whenever I see a gray background on an Excel graph, it says to me "I'm a total noob! Or I'm too lazy to bother adjusting Excel's built-in defaults."

Anyway, good luck. :smile:
 
Last edited:
  • #13
You are right about the white background in graphs. I normally do that too (but haven't doen it yet in this one... :-) ) - Well, done it now...

Yes, I am now using the cos/sin-formulas for the ellipse - hey, did you write wrong again? Shouldn't you use sin for y?? Or is it cos for both x and y?

I use degrees rather than radians, as I don't "understand" radians. So I just write in Excel for cos(t): COS(t*PI()/180), t given in degrees.

To do what I wanted, I used the following approach:
First I made a set of x,y columns, creating just the ellipse and nothing else. Then I made a column called degrees and a new set of columns called x' and y' - and here calculated the rotated ellipse. In the x,y columns, I could then find the (0,-b) and compare with the values in x',y' columns. Then I could create a formula for how much x',y' was moved compared to x,y, plus I knew where I wanted the "0,-b" point to be located - and made that in a new set of columns x'',y''.

This ellipse approach is a add-on to another Excel program. This program can be used to study different limb profiles for bows (archery), how they will bend etc. up to a full drawn bow. The ellipse add-on was an idea I got, to have a way to automatically calculate a mathematical correct geometrical curve for the bow-limb. The ellipse add-on can be used to make about anything from straight limbs over slightly curved limb to curled recurve bow limbs. See also attached to get an idea of how I use it.

If you see something that doesn't look correct in how I rotate and move the ellipse etc., just tell me.
 

Attachments

  • Supertiller, with ellipse add-on, v6_0.pdf
    15.7 KB · Views: 802
  • Supertiller, ellipse add-on, v6_0, design.pdf
    18 KB · Views: 599
  • Supertiller, ellipse add-on, v6_0, braced bow.pdf
    6.8 KB · Views: 615

1. How do I create an ellipse at an angle in Excel?

To create an ellipse at an angle in Excel, you will need to use the formula =PI()*RADIAN(angle), where "angle" is the desired angle of the ellipse in degrees. This will give you the value of pi multiplied by the angle in radians, which you can then use in other formulas to create the ellipse.

2. Can I change the size of the ellipse at an angle in Excel?

Yes, you can change the size of the ellipse at an angle in Excel by adjusting the values in the formula. The formula for an ellipse at an angle is (x*cos(angle))^2 + (y*sin(angle))^2 = 1, where x and y are the coordinates of the point on the ellipse. By changing the values of x and y, you can change the size of the ellipse.

3. How can I draw an ellipse at an angle in Excel?

To draw an ellipse at an angle in Excel, you can use the built-in drawing tools. Under the "Insert" tab, click on "Shapes" and choose the "Ellipse" shape. Click and drag on the worksheet to draw the ellipse. To rotate the ellipse, click on it to select it and then use the rotation handle to adjust the angle.

4. What is the significance of an ellipse at an angle in Excel?

An ellipse at an angle in Excel is often used in geometry and physics to represent the path of a moving object in two dimensions. It can also be used in data analysis to fit data points to an elliptical curve.

5. Can I use an ellipse at an angle in Excel for data visualization?

Yes, an ellipse at an angle can be used for data visualization in Excel. It can be used to represent a relationship between two variables or to visualize the distribution of data points. By adjusting the size and angle of the ellipse, you can create different visualizations to analyze your data.

Similar threads

Replies
6
Views
1K
Replies
49
Views
2K
Replies
1
Views
2K
Replies
10
Views
1K
  • Introductory Physics Homework Help
Replies
6
Views
877
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
Replies
4
Views
967
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Replies
3
Views
1K
Back
Top