Menu

(Solved) : Inputs 1 Double Vector Masses Set Objects 2 Double Vector Masses Another Set Objects 3 Dou Q44021225 . . .

Inputs: 1. (​double) ​A vector of masses of a set of objects 2.(double)​ A vector of masses of another set of objects 3. (double)​A vector of the distances between the pairs of objects

Outputs: 1. (​double​) A vector of the gravitational forcevalues between the objects

Background: You are working on your physics homework, buteventually realize you would much rather be doing CS 1371 homeworkinstead. The only obvious solution? Turn your physics homework intoCS 1371 homework! Use MATLAB to solve your physics homeworkproblems by calculating the gravitational force betweenobjects.

Function Description: You will be given 3 input vectors: 2 setsof objects and the distances between them. For example, the firstvalue in each of the first two vectors each correspond to the massof an object, and the first value in the distance vectorcorresponds to the distance between those two objects. Use elementby element operations to calculate the gravitational force betweeneach of the pairs of objects with the following formula: F = Gm1m2gd2 Use ​6.67e-11​ as the gravitational constant G. Round to 4decimal places.

Example: mass1 = [100000, 200000, 300000]; mass2 = [800000,900000, 1000000]; distance = [1, 2, 3]; Fg = calcGravity(mass1,mass2, distance); Fg → [5.3360, 3.0015, 2.2233]

Expert Answer


Answer to Inputs: 1. (​double) ​A vector of masses of a set of objects 2. (double)​ A vector of masses of another set of obj…

OR