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

Get Higher Grades Now

Tutors Online