"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; %semimajor axis
> bE=aE*(1eE^2)^.5; %semiminor axis
> rpE=aE*(1eE); %perihelion
> lE=(45)*0.0175; %angle to rotate ellipse
> xe=(aE*cos(q)(rpEaE));
> 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).
