Tham khảo tài liệu 'robotics process control book part 8', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 120 Dynamical Behaviour of Processes The program written in GW-BASIC is given in Program . The state-space differential equations are defined on lines 550 560. The solution yi t Xi t y2 t x2 t calculated with this program is given in Table . The values of variable y2 t represent the step response of the system with transfer function G s m ZL . U s T1s 1 T2s 1 Program is written in C. The example of the solution in the simulation environment MATLAB Simulink is given in Program . This represents m-file that can be introduced as S-function into Simulink block scheme shown in Fig. . The graphical solution is then shown in Fig. and it is the same as in Tab. . Program Simulation program in GW-BASIC 5 REM 10 REM solution of the ODE system 20 REM n number of equations 30 REM h integration step 50 REM y 1 y 2 . y n initial conditions 55 DATA 2 rEaD n 58 DIM y n x n f n k 4 n 60 DATA .5 0 0 70 READ h 80 FOR i 1 TO n READ y i NEXT i 140 PRINT t y1 y2 160 PRINT t y 1 y 2 200 FOR k 0 TO 19 205 FOR i 1 TO n x i y i NEXT i GOSUB 470 240 FOR i 1 TO n 242 k 1 i h f i x i y i k 1 i 2 244 NEXT i GOSUB 470 290 FOR i 1 TO n 292 k 2 i h f i x i y i k 2 i 2 294 NEXT i GOSUB 470 340 FOR i 1 TO n 342 k 3 i h f i x i y i k 3 i 344 NEXT i GOSUB 470 390 FOR i 1 TO n 392 k 4 i h f i 410 y i y i k 1 i 2 k 2 i 2 k 3 i k 4 i 6 420 NEXT i 430 t t h 440 PRINT t y 1 y 2 450 NEXT k 460 END 470 REM assignments 480 z1 1 te1 1 te2 2 510 u 1 520 x1 x 1 x2 x 2 540 REM funkcie 550 f 1 z1 u - x2 - te1 te2 x1 te1 te2 560 f 2 x1 570 RETURN Computer Simulations 121 Program Simulation program in C include void rk45 double u double y double f double dt void fun double y double f double u define N 2 number of ODEs int main void double t 0 tend 10 dt double y N u 1 double f N u 0 1 y 0 0 y 1 0 printf f f f n t y 0 y 1 do rk45 u y f dt t dt printf f f f n t y 0 y 1 while t tend return 0 void fun double y double f double u static double .