Пример #1
0
    def test_canon(self):
        a = [4, 5]
        b = [1, 1, 2, 3]

        G, H, C = ccde.buildSSfromTF(a, b)
	Gb, Hb, Cb, P = ccde.canon(G, H, C)
        assert_almost_equal(G, numpy.matrix([[ 0.,  1.,  0.], [ 0.,  0.,  1.], [ -3.,  -2.,  -1.]]))
        assert_almost_equal(H, numpy.matrix([[ 0.], [ 0.], [ 1.]]))
        assert_almost_equal(C, numpy.matrix([[ 5.,  4.,  0.]]))
Пример #2
0
    def test_ctrb(self):
        A = numpy.matrix([[-2, 1], [-2, 0]])
        B = numpy.matrix([[1], [3]])
        C = numpy.matrix([[1, 0]])
        ct = ccde.ctrb(A, B)
        assert_almost_equal(ct, numpy.matrix([[1, 1], [3, -2]]))
	
	Gb, Hb, Cb, P = ccde.canon(A, B, C)
        assert_almost_equal(Gb, numpy.matrix([[0, 1], [-2, -2]]))
        assert_almost_equal(Hb, numpy.matrix([[ 0.], [ 1.]]))
        assert_almost_equal(Cb, numpy.matrix([[ 3.,  1.]]))