function y = cartrailertraj(u)
%
% matlab implementation of trajectory generation
% if u(1) > 80 - 13.121
%     y(3,1) = -25*sin(pi/6) + (u(1)-75-13.121)*sin(pi/6)
%     y(1,1) = pi/6;
% else
if u(1) >= 40 - 13.121
    y(3,1) = (2*13.439  - (u(1)-13.121)*sin(pi/6));
    y(1,1) = -pi/6;
    
else
    y(3,1) = (u(1)-13.121)*sin(pi/6)*(u(1)>13.121);
    y(1,1) = pi/6;
    
end

%     y(1,1) = sin(pi/50*u(1));
y = [zeros(5,1); 0; y(3,1); y(1,1)];