In Matlab, how do I: Create and attach a program that will solve the following:
ID: 3770973 • Letter: I
Question
In Matlab, how do I:
Create and attach a program that will solve the following:
Have a user input masses for two interstellar objects, and calculate the gravitational force between the objects using Newton's Law of Universal Gravitation, Eqn 1, as the radius varies from 4 km to 400 km. Where F is the gravitational force, G is the gravitational constant, m1 and m2 is the two masses respectively, and r is the radius between the objects. G = 6.674x10-11 N(m/kg)2.
Also, output a graph of the gravitational force of the problem over the indicated domain of the radius.
Explanation / Answer
matlab code :
function grav_force()
m1=input('m1: ');
m2=input('m2: ');
function y=gf(r1)
y=(6.674*power(10, -11)*m1*m2)/(r1*r1);
end
fh=@gf;
fplot(fh,[4,400]);
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.