FOR THOSE WHO WANT TO USE ANALYTICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS GOVERNING SYSTEM “CART-PENDULUM” u M ( a b) (1) where u is control action, and its parameters are to satisfy: b 0, a ( 1) g (2) Behavior of angle is given by (in this equation control u is already taken into account) 3b 3(a g ( 1)) 0 (3) ( 4 )l ( 4 )l with initial conditions (0) 0, (0) 0 (4) Behavior of the cart is defined by 4 y l g (5) 3 with initial conditions y (0) y (0) 0 (6) This system of equations may be solved analytically, because here we have linear differential equations with constant coefficients, but in general case, only numerical discrete approach may be used. So, we seek solution of (3) in the form Ce pt (7) Substituting (7) into (3), we get 3b 3( a g ( 1)) Ce pt ( p 2 p ) 0 (8) ( 4 )l ( 4 )l So, we have got algebraic quadratic equation from which, in general, 2 roots may be obtained, depending on value of discriminant 9b 2 3(a g ( 1)) (9) D 4 2 2 ( 4)l ( 4) l Case 1. D>0 (2 distinct real roots). 3b D ( 4 )l (10) p1, 2 2 Substituting roots (10) into (7), we get (11) C1e p1t C2 e p2t Expression (11) has 2 not defined yet constants, values of which can be determined using initial conditions (4): C1 C2 (0) (12) p C p C (0) 1 1 2 2 Solving (12), we get C 2 (0) C1 p1C1 p 2 ( (0) C1 ) (0) C ( p p ) (0) p (0) 1 C1 1 2 2 (0) p 2 (0) p1 p 2 (0) p 2 (0) C 2 ( 0) p1 p 2 (0)( p p ) ((0) p (0)) (13) 2 p1 p 2 (0) p1 (0) (0) p1 (0) p1 p 2 p 2 p1 So, this case corresponds to the solution represented by 2 exponents which grow in the case of positive roots and vanish in the case of negative roots. Case 2. D=0 (2 equal real roots). In the case of equality of roots (13) is not applicable (denominators are equal to 0). In this case we have 3b ( 4 )l p1, 2 p (14) 2 In such a case solution of (3) we represent as (15) C1e pt C2 te pt with value of p defined by (14). It may be directly checked that 2nd term in (15) also satisfies (3). From (15) and initial conditions (4) we get: C1 (0) C p C (0) (16) 1 1 2 2 C 2 (0) p (0) Case 3. D<0 (2 distinct complex roots) p1, 2 3b i D ( 4 )l , 2 where i 1 . By introducing 3b , (17) 2( 4)l we can write solution in this case: C1e ( i )t C2 e ( i )t (18) By definition, e i cos i sin (19) 2 D / 4, Substituting (19) in (18), we get et (C1e it C2 e it ) et (C1 (cost i sin t ) C2 (cost i sin t )) et (cost (C1 C2 ) i sin t (C1 C2 )) C11et cost iC 21 et sin t (20) Using initial conditions (4) and (20), we can define constants C11 ,C 21 : (0) C11 (0) C 1 iC 1 (0) iC 1 (21) 1 C 21 2 2 (0) (0) i Substituting (21) in (20), we get (0) (0) t (0)et cost e sin t (22) So, we have got solutions for equation (3) with initial conditions (4) in the Case 1 (expressions (10), (11), (13)), Case 2 (expressions (14)-(16)), Case 3 (expressions (9), (17), (22)). Using , we can get u from (1), substituting and its derivative in the right hand side of (1). Using , we can get y from (1), substituting and its 2nd derivative in the right hand side of (5) and integrating twice right hand side. Other way, more simple, is to use discrete representation of 2nd derivative of y as d 2 y y (t 2t ) 2 y (t t ) y (t ) (23) dt 2 t 2 Using (23), we can find next y, if we have 2 previous. These first 2 we can find from initial conditions (6): y (0) 0, (24) y ( t ) y (0) ty (0) 0 Due to not zero values of the right hand side of (5), next values of y may be not zeroes.