Analysis of the dynamical behavior of a Q-switched CO2 laser: the linear and the nonlinear regime