clear, clc
g = 1.6;
start = 0;
finish = 100;
incr = 10;
fprintf ('For an acceleration due to gravity of %1.1f seconds \n', g)
fprintf ('starting at %d seconds ', start)
fprintf ('and calculating to %d seconds', finish)
fprintf (' with %d second intervals, \nthe final distance is calculated to be', incr)
time = start:incr:finish;
distance = 1/2*g*time.^2;
plot(time,distance)
title('Distance Traveled in Free Fall')
xlabel('time, s')
ylabel('distance, m')
grid
final_distance = max(distance);
fprintf(' %d meters', final_distance)
For an acceleration due to gravity of 1.6 seconds
starting at 0 seconds and calculating to 100 seconds with 10 second intervals,
the final distance is calculated to be 8000 meters