

#
# y'' + 2.5y' + 5y = 4u
#
# x1 = y
# x2 = y'
#
# x1' = x2
# x2' + 2.5 x2 + 5 x1 = 4 u
#
#
# x1' = |  0      1 | |x1|   |0|
# x2' = | -5   -2.5 | |x2| + |4| u
#
class G1:
    def __init__(self):
        self.x1 = 0
        self.x2 = 0

    def evaluate(self, u, delta_t):
        temp_x1 = self.x1 + self.x2 * delta_t
        temp_x2 = self.x2 - 5 * delta_t * self.x1 - 2.5 * delta_t * self.x2 + 4 * delta_t * u
        output = self.x1
        self.x1 = temp_x1
        self.x2 = temp_x2
        return output



