how do I write a program that simulates a group of orbit ing bodies using MATLAB.

1 view (last 30 days)
gravatational constant(G) =6.673 x 10^-11. firstly i have to write a script for two bodies with the same forces of attraction to each other. formulas to use are, F1 = F2 = G*m1m2/r^2 where r is the distance between the two forces. m1 and m2 = the two masses. the rate of change of the velocity = Motion Knowing the force is not enough to solve this problem . As F(sum) =m*dv/dt the bodies move the magnitude and the direction of the forces will change. Newton’s 2 nd Law is used to relate forces acting on a body and the rate of change of velocity (acceleration) of that body. Newton’s 2 nd Law can be written as: where is the sum of forces acting on a body, is the mass of the body, and is the rate of change of velocity. To simulate this system, we represent it at a sequence of closely spaced steps in time. For example, we might calculate the system at seconds, and then seconds, and then seconds, and so on. We define a small time step , from which we calculate the time at the ith
timestep as . The subscript “i” denotes the i th time step. In this example, seconds. You will need to experiment to determine the appropriate value of . If is small enough, we assume that is constant over that t ime step . This means we can replace the previous equation with this equation:F(sum)=Vi-vi-1/Change in time where is the velocity at the i th timestep , and is the velocity at the previous time step . Therefore the simulation procedure is as follows. For each particle, w e determine the force ( using the gravitation law previously given . Then we calculate the new velocity using the above equation ; S=Vi * +change in Time+ si -1 , including the previous velocity . With the new value of velocity we can determine a new position (S) using this equation: where is the new position, is the velocity from the previous equation, is the same small time step and is the previous position. Vectors The equations were given in vector form. If you are not comfortable working in vector form (terms with the vector notation such as ) then you can replace each vector equation with two equations denoting x and y components. This is an exercise I will le ave to you.

Answers (0)

Categories

Find more on Gravitation, Cosmology & Astrophysics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!