1

I was wondering if anyone can help me. I'm trying to modal an oval room, and the joists run parallel to one another at 400mm intervals, starting and finishing 200mm from the apexes of the oval. The central joist falls on the centre of the oval at (0,0).

So the oval is positioned at angle = 0, with a centre of (0,0). The major axis is 6000mm long in the x-direction and the minor axis is 3500mm long in the y-direction. The joists run in the y-direction too.

I need to find out the node for each joist along the outside edge of the ellipse. So obviously, I know the x values will be -2800, -2400, ..., 0, ..., 2000, 2400, 2800, and that the central joist will have one node at (0, 1750) and one at (0, -1750), but how can I find the y values for all the other x co-ordinates?

Many thanks.

p.s. In case you can't tell I have exceedinly rudimentary MATLAB skills.

Blue Plum
  • 11
  • 2
  • Have a look [here](http://stackoverflow.com/questions/2153768/draw-ellipse-and-ellipsoid-in-matlab) and [here](http://www.mathworks.com/matlabcentral/answers/86615-how-to-plot-an-ellipse). – Stewie Griffin Jan 06 '15 at 15:41
  • I've managed to draw the ellipse, and plot it, but in the array I want to find the y value for a specific x value. Any ideas? At the moment, the array columns don't seem to be named. – Blue Plum Jan 06 '15 at 15:44
  • Can't you just use the same formula you used when drawing the ellipse? – Stewie Griffin Jan 06 '15 at 15:46
  • I don't know how to extract the 'finding and displaying the y value' bit, for my x values. I kind of cobbled the formula together sing lots of help tutorials. – Blue Plum Jan 06 '15 at 15:54
  • How about interpolating? You have the `(x,y)` coordinates of your ellipse stored somewhere, or else you couldn't plot. Now you can use something like `interp` to to get the `y`-values for your new (?) `x`-values. – Schorsch Jan 06 '15 at 18:12

1 Answers1

0

It's convenient to work with semi-axes, denoted a and b below. The equation of ellipse is (x/a)^2+(y/b)^2=1, which gives two values of y, positive b*sqrt(1-(x./a)^2) and negative b*sqrt(1-(x./a)^2).

In MATLAB you can compute them this way:

a = 6000/2;
b = 3500/2;
x = -2800:400:2800;
yP = b.*sqrt(1-(x./a).^2);
yN = - yP;

So, yP contains the positive y-coordinates and yN contains negative y-coordinates.

The dots in front of arithmetic operations mean they are performed on vectors componentwise.