In this work, we have modelled the problem of maximizing the velocity of a rocket moving with a rectilinear motion by a linear optimal control problem, where the control represents the action of the pilot on the rocket. In order to solve the obtained model, we applied both analytical and numerical methods. The analytical solution is calculated using the Pontryagin maximum principle while the approximate solution of the problem is found using the shooting method as well as two techniques of discretization: the technique using the Cauchy formula and the one using the Euler formula. In order to compare the different methods, we developed an implementation with MATLAB and presented some simulation results.