Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Rotating Ellipse

Subject: Rotating Ellipse

From: Chris

Date: 20 Feb, 2009 17:57:01

Message: 1 of 2

Hi, I have an ellipse which will in time represent that of a planet and overlay other planet's on top. All of the ellipse's semi major axes are not in line so I need to rotate the ellipse to correct this, and this is what I'm having trouble with!
The other point is I need focus of the ellipse at the centre (0,0) not the centre of the ellipse. Below is the code I have created for this. I have increased the eccentricity so it is easier to see the result.

Cheers,
Chris
%------------------
AU=1.5e11;
q=(0:0.01:2)*pi;

%Earth
eE=0.817; %eccentricity
aE=1*AU; %semi-major axis
bE=aE*(1-eE^2)^.5; %semi-minor axis
rpE=aE*(1-eE); %perihelion
lE=(45)*0.0175; %angle to rotate ellipse
xe=(aE*cos(q)-(rpE-aE));
ye=(bE*sin(q));

%Sun
x=7e8*cos(q);
y=7e8*sin(q);

f=figure(1);
plot(xe,ye,x,y);
axis([-2.5*AU 2.5*AU -2.5*AU 2.5*AU]);

Subject: Rotating Ellipse

From: someone

Date: 20 Feb, 2009 20:17:02

Message: 2 of 2

"Chris " <chris.crawshaw@gmail.com> wrote in message <gnmqtd$ip4$1@fred.mathworks.com>...
> Hi, I have an ellipse which will in time represent that of a planet and overlay other planet's on top. All of the ellipse's semi major axes are not in line so I need to rotate the ellipse to correct this, and this is what I'm having trouble with!
> The other point is I need focus of the ellipse at the centre (0,0) not the centre of the ellipse. Below is the code I have created for this. I have increased the eccentricity so it is easier to see the result.
>
> Cheers,
> Chris
> %------------------
> AU=1.5e11;
> q=(0:0.01:2)*pi;
>
> %Earth
> eE=0.817; %eccentricity
> aE=1*AU; %semi-major axis
> bE=aE*(1-eE^2)^.5; %semi-minor axis
> rpE=aE*(1-eE); %perihelion
> lE=(45)*0.0175; %angle to rotate ellipse
> xe=(aE*cos(q)-(rpE-aE));
> ye=(bE*sin(q));
>
> %Sun
> x=7e8*cos(q);
> y=7e8*sin(q);
>
> f=figure(1);
> plot(xe,ye,x,y);
> axis([-2.5*AU 2.5*AU -2.5*AU 2.5*AU]);

% Take a look at:

http://mathworld.wolfram.com/Ellipse.html

% There are a lot of transfomations there
% especially going from centered at (0,0) to arbitrary (x,y).

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us