Added the generateMatrices() function in order to adapt the kalman to different orders