1 Exercise
Write a Matlab function which shows the movement of planets. Write a
report (≤ 1.5 computer typed pages) on your code and results. Refer to
“Report guidelines” for the structure of the report.
We will want to model the position x and the velocity v (the derivative
over time of x). We base our discussion on the fact that the movement of
planets (and the sun) is governed by Newton’s laws of gravitation.
First, the acceleration a (the derivative over time of v) is equal to the
force F divided by the mass m, that is
Second, each two masses m1 and m2 exert a force on each other: the gravitational force given by
where r is the distance between the masses and G = 6.672 · 10−11Nm2kg−2
is the gravitational constant. The direction of the force is such that each
mass is attracted to the other one.
The coded funcstion should have input parameters a vector m with the
masses of the planets (say of length p), a matrix of initial positions (n × p),
a matrix of initial velocities (n × p), and the length of time T over which
the movements should be computed. The function makes a picture of the
orbits and returns as output a vector of points in time and a matrix of
corresponding positions and velocities of the planets
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |