function F = gravitational_force (m1, m2, r)
% function F = gravitational_force (m1, m2, r)
% Script file: gravitational_force.m
%
% Purpose:
% Calculate the gravitational force between two bodies of masss m1 and
% m2:
%
% Define variables:
% m1 -- mass, kilogram
% m2 -- mass, kilogram
% r -- the distance between two bodies, unit m
% F -- gravitational force between two bodies
%
%
% Record of revisions:
% Date Programmer Description of change
% ==== ========= ================
% 02/01/2024 Original code
%
%test
% m1 = 800; % satellite
% m2 = 5.98e24; % earth
% r = 38000 * 1000; % 38000 km
narginchk(3,3);
G = 6.672e-11; % 单位:N m^2/kg^2
F = G * m1 * m2 / r^2
MATLAB代码(万有引力计算,重力计算)
最新推荐文章于 2024-05-09 22:51:45 发布