%% Example 7.2
%Freefall
clear, clc
%Request input from the user
g = input('What is the value of acceleration due to gravity?')
start=input('What starting time would you like?')
finish = input('What ending time would you like?')
incr = input('What time increments would you like calculated?')
t=start:incr:finish;
%Calculate the distance
d=1/2*g*t.^2;
%Create a matrix of the output data
table=[t;d];
%Send the output to the command window
fprintf('For an acceleration due to gravity of   %5.1f seconds \n the … following data was calculated \n', g)
disp('Distance Traveled in Freefall')
disp('time,sec     distance, m')
fprintf('%8.0f  %10.2f\n',table)