File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 11using ModelingToolkit, ADTypes, Test
22using CommonSolve: solve
33
4-
54# Test reorder_unknowns
65# sys = ssrand(1,1,4);
76mats = let
8- A = [- 1.617708540405859 0.14199864151523162 1.8120551022076838 - 1.246419696614408 ; 0.6704209450894298 - 2.4251566699889575 0.6782529705706082 - 1.3731519847672025 ; - 0.09336677360807291 - 0.11211714788917712 - 3.6877851408229523 - 0.7073967284605489 ; - 1.1743200892334098 1.1808779444006103 1.5721685015907167 - 0.10858833182921268 ]
7+ A = [- 1.617708540405859 0.14199864151523162 1.8120551022076838 - 1.246419696614408 ;
8+ 0.6704209450894298 - 2.4251566699889575 0.6782529705706082 - 1.3731519847672025 ;
9+ - 0.09336677360807291 - 0.11211714788917712 - 3.6877851408229523 - 0.7073967284605489 ;
10+ - 1.1743200892334098 1.1808779444006103 1.5721685015907167 - 0.10858833182921268 ]
911 B = [- 0.3286766047686936 ; - 1.8473436385672866 ; - 2.4092567234250954 ; - 0.06371974677173559 ;;]
1012 C = [- 0.7144567541084362 0.18898849455229796 0.023473101245754475 1.0369097263843963 ]
1113 D = [0.6397583934617636 ;;]
1214 (; A, B, C, D)
1315end
1416@variables x1 x2 x3 x4
15- new = [x4,x1,x3,x2]
16- old = [x1,x2,x3,x4]
17+ new = [x4, x1, x3, x2]
18+ old = [x1, x2, x3, x4]
1719lsys = ModelingToolkit. reorder_unknowns (mats, old, new)
1820P = [0 1 0 0 ; 0 0 0 1 ; 0 0 1 0 ; 1 0 0 0 ]
1921@test isequal (P* new, old)
2022@test lsys. A == ModelingToolkit. similarity_transform (mats, P). A
2123
22-
2324# r is an input, and y is an output.
2425@independent_variables t
2526@variables x (t)= 0 y (t)= 0 u (t)= 0 r (t)= 0
You can’t perform that action at this time.
0 commit comments