i want to plot the precession of mercury's perihelion in MatLaB .(like the image below).Help me out here ,guys. https://en.wikipedia.org/wiki/Apsidal_precession#/media/File:Perihelion_precession.svg

Update: I did plot in matlab but the figure is not matching with the desired perihelion precession . This is my code.

x=a^2+b^2 +a*cos(2*pi*v1*t).*cos(2*pi*v2*t)-lambda*b*sin(2*pi*v1*t).*sin(2*pi*v2*t); 
y=a^2+b^2 +a*sin(2*pi*v1*t).*cos(2*pi*v2*t)-lambda*b*cos(2*pi*v1*t).*sin(2*pi*v2*t);

enter image description here


closed as too broad by Emilio Pisanty, CR Drost, stafusa, Daniel Griscom, John Rennie Nov 4 '17 at 7:25

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Something like that for example ??

enter image description here


The parametric equations of the curve are :

\begin{align} x(t) & = \left[\sqrt{a^2-b^2}+a\cos\left(2\pi\nu_{\theta} t\right)\right] \cos\left(2\pi\nu_{\phi} t\right)-b\,\sin\left(2\pi\nu_{\theta} t\right)\sin\left(2\pi\nu_{\phi} t\right) \tag{01a}\\ y(t) & = \left[\sqrt{a^2-b^2}+a\cos\left(2\pi\nu_{\theta} t\right)\right] \sin\left(2\pi\nu_{\phi} t\right)+ b\,\sin\left(2\pi\nu_{\theta} t\right)\cos\left(2\pi\nu_{\phi} t\right) \tag{01b} \end{align}

The graph shown in the Figure is produced by GeoGebra software.

The variables and the values given are : \begin{align} a & = \text{major semi-axis} = 5 \tag{02a}\\ b & = \text{minor semi-axis} = 3 \tag{02b}\\ \nu_{\theta} & = \text{frequency of rotation of the particle on its elliptical orbit}= 3 \tag{02c}\\ \nu_{\phi} & = \text{frequency of rotation of the elliptical orbit around a focus}= 1/10 \tag{02d}\\ t & = \text{parameter of the curve representing the time} \in \left[0,1.22 \right] \tag{02e} \end{align}

The graph of the curve represents the orbit of a particle moving on an ellipse rotating around one of its focal points, simulating the motion of planet Mercury around the Sun. The values given to the variables are indicative without any relation to the values of the motion of planet Mercury.


Et voilà your MatLab code and graphics

t = [0:.001:1.22];
x=(sqrt(a^2-b^2) +a*cos(2*pi*v1*t)).*cos(2*pi*v2*t)-b*sin(2*pi*v1*t).*sin(2*pi*v2*t);
y=(sqrt(a^2-b^2) +a*cos(2*pi*v1*t)).*sin(2*pi*v2*t)+b*sin(2*pi*v1*t).*cos(2*pi*v2*t);

enter image description here

  • $\begingroup$ yeah like that one. can you give me the whole code? $\endgroup$ – user1157 Nov 4 '17 at 10:04
  • $\begingroup$ @user1157 I produced it by GeoGebra software not MatLab. Take the curve equation in the Figure, give values to the variables etc. Take a look in my answer therein : Painting with a Pendulum: Would it be possible to graph the pattern? in order to understand the meaning of the variables. $\endgroup$ – Frobenius Nov 4 '17 at 10:13
  • $\begingroup$ you have given third brackets . should i take the modulus values in there ? still trying to code it in matlab . $\endgroup$ – user1157 Nov 10 '17 at 10:39
  • $\begingroup$ @user1157 I apologize, but I don't understand what are you asking for. $\endgroup$ – Frobenius Nov 10 '17 at 10:56
  • $\begingroup$ updated the Question. I think i am not giving correct values to the variables. $\endgroup$ – user1157 Nov 10 '17 at 17:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.