Analysis of discrete-time piecewise affine and hybrid systems