g = 9.81;
u = 60;
t = 0:0.1:12.3; % time in seconds
for i = 1:length(t);
s(i)= (u.*t(i))-(g.*t(i).^2)./ 2;
plot(t(i),s(i));
xlim([0 14]);
ylim([0 200]);
hold on;
drawnow
title('Vertical motion under gravity');
xlabel('time');
ylabel('vertical displacement');
end
figure
plot(t,s)