Question: Write a MATLAB function named gravForce that will compute the magnitude of the gravitational force between two objects of the same mass given three input
Write a MATLAB function named gravForce that will compute the magnitude of the gravitational force between two objects of the same mass given three input variables:
- the xy coordinate of the center of the first object as a 1x2 matrix
- the xy coordinate of the center of the second object as a 1x2 matrix
- the mass of each object
The return of the function should be a single output containing the gravitational force.
To compute gravitational force, Fg, use the equation shown in the figure: G is the gravitational constant = 6.67e-11 d is the distance between the two objects M is the mass of each object Notes:
- Example test case: Fg = gravForce([3,2],[6,7],100) results in Fg=1.9618e-08
- Do not include any test cases in the answer you submit.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
