Question: Matlab script help? I have to use Matlab script file to create a program that calculates to force between 2 masses(planets), based on their distance,

Matlab script help?

I have to use Matlab script file to create a program that calculates to force between 2 masses(planets), based on their distance, using newton's law of Universal Gravitation; F=G*m(a)*m(b) all over r^2. Where G=6.673x10-11 Nm2/kg2. The program must represent numerical values as variables(not using the actual numbers) The program must a user in the command window for two masses of the two bodies and a range of distances(10 distances total, ranging from 3.8x108 m to 4.0x108). Program should output to the command window, a table with distances in column 1 and forces in column 2, both printed to 4 significant digits. I've gotten as far as the following(the following script in matlab), But i can't figure out how to make it enter a range of r values, or output to a table.

%clear window

clc

%equation -> force exerted by one celestial body on another as a function of distance F=(G*m1*m2)/(r^2

G=6.673*10^-11; %Newton's Gravitational Constant

m1=input ('enter mass of planet 1');

m2=input ('enter mass of planet 2');

r=input ('enter range of distances between planet 1 and planet 2');

F=G*m1*m2./r.^2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!