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 1
1
using ModelingToolkit, ADTypes, Test
2
2
using CommonSolve: solve
3
3
4
-
5
4
# Test reorder_unknowns
6
5
# sys = ssrand(1,1,4);
7
6
mats = 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 ]
9
11
B = [- 0.3286766047686936 ; - 1.8473436385672866 ; - 2.4092567234250954 ; - 0.06371974677173559 ;;]
10
12
C = [- 0.7144567541084362 0.18898849455229796 0.023473101245754475 1.0369097263843963 ]
11
13
D = [0.6397583934617636 ;;]
12
14
(; A, B, C, D)
13
15
end
14
16
@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]
17
19
lsys = ModelingToolkit. reorder_unknowns (mats, old, new)
18
20
P = [0 1 0 0 ; 0 0 0 1 ; 0 0 1 0 ; 1 0 0 0 ]
19
21
@test isequal (P* new, old)
20
22
@test lsys. A == ModelingToolkit. similarity_transform (mats, P). A
21
23
22
-
23
24
# r is an input, and y is an output.
24
25
@independent_variables t
25
26
@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