% Example 7.1
clear, clc
%the acceleration due to gravity
g = 1.6;
%the start/end time in seconds
start = 0;
finish = 100;
%the number of second to increment at
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;
%calculate the distance
distance = 1/2*g*time.^2;
%plot the results
plot(time,distance)
title('Distance Traveled in Free Fall')
xlabel('time, s')
ylabel('distance, m')
grid
%calculate the maximum distance traveled
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