function graph = Trajectory
% Computest the smallest absulute value of the matrix E.
%
% Synopsis: graph = Trajectory
%
% input:    none
%
% output:   graph the function y(t)

% constants
R = 19;
v = 10;
theta = 40*(pi/180);
t = [0:0.01:2.48];

% function
y = R.*sin(theta) + v.*cos(theta).*t - (9.81/2).*t.^2;

% compute the maximum value of y
[y_1,location] = max(y);




t_first = [0:0.01:t(79)];
y_first = R.*sin(theta) + v.*cos(theta).*t_first - (9.81/2).*t_first.^2;

t_second = [t(79):0.01:2.48];
y_second = R.*sin(theta) + v.*cos(theta).*t_second - (9.81/2).*t_second.^2;



% Graph the function
plot(t_first, y_first, 'r', t_second, y_second, 'b', t, y_1, '-.'), ...
    xlabel('Time(sec)'), ylabel('y(cm)'), ...
    title('Motion of a Cannon Ball'), ...
    legend('ascent','decent','Location', 'southwest'), ...
    text(1.8,15.5,'celing'), grid