summaryrefslogtreecommitdiffstats
path: root/scilab/modules/cacsd/tests/unit_tests/arma2ss.dia.ref
blob: 4953dd83befb55f0702cb89de6a25f5351d8790b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//<-- CLI SHELL MODE -->
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2012 - INRIA - Serge Steer
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
//
ny=1,nu=1,sig=0.01;
 ny  = 
    1.
 nu  = 
    1.
ar=armac(1,[0,0.2],[0,1],ny,nu,sig);
[S,Sn]=arma2ss(ar);
A=[0,0.2;0,0];B=[0;1];C=[1,0];D=0;
assert_checkequal(S.A,A);
assert_checkequal(S.B,B);
assert_checkequal(S.C,C);
assert_checkequal(S.D,D);
A=[0,1;0,0];B=[0;0.01];C=[1,0];D=0;
assert_checkequal(Sn.A,A);
assert_checkequal(Sn.B,B);
assert_checkequal(Sn.C,C);
assert_checkequal(Sn.D,D);
//
ny=1,nu=1;
 ny  = 
    1.
ar=armac([1,-0.8,0.2],0.001,0,ny,nu,0);
[S,Sn]=arma2ss(ar);
A=[0.8,-0.2;1,0];B=[0.001;0];C=[1,0];D=0;
assert_checkequal(S.A,A);
assert_checkequal(S.B,B);
assert_checkequal(S.C,C);
assert_checkequal(S.D,D);
A=[0.8,-0.2;1,0];B=[0;0];C=[1,0];D=0;
assert_checkequal(Sn.A,A);
assert_checkequal(Sn.B,B);
assert_checkequal(Sn.C,C);
assert_checkequal(Sn.D,D);
a=[1,-2.851,2.717,-0.865].*.eye(2,2);
b=[0,1,1,1].*.[1;1];
d=[1,0.7,0.2].*.eye(2,2);
sig=eye(2,2);
ar=armac(a,b,d,2,1,sig);
[S,Sn]=arma2ss(ar);
A=[2.851,0,    -2.717,0,     0.865,0,    1,1,1;
   0,    2.851,0,     -2.717,0,    0.865,1,1,1;
   1,    0,    0,      0,    0,    0,    0,0,0;
   0,    1,    0,      0,    0,    0,    0,0,0;
   0,    0,    1,      0,    0,    0,    0,0,0;
   0,    0,    0,      1,    0,    0,    0,0,0;
   0,    0,    0,      0,    0,    0,    0,0,0;
   0,    0,    0,      0,    0,    0,    1,0,0;
   0,    0,    0,      0,    0,    0,    0,1,0];
B=[0;0;0;0;0;0;1;0;0];
C=[1,0,0,0,0,0,0,0,0;
   0,1,0,0,0,0,0,0,0];
D=[0;0];
assert_checkequal(S.A,A);
assert_checkequal(S.B,B);
assert_checkequal(S.C,C);
assert_checkequal(S.D,D);
A=[2.851,0,-2.717,0,0.865,0,0.7,0,0.2,0;
   0,2.851,0,-2.717,0,0.865,0,0.7,0,0.2;
   1,0,0,0,0,0,0,0,0,0;
   0,1,0,0,0,0,0,0,0,0;
   0,0,1,0,0,0,0,0,0,0;
   0,0,0,1,0,0,0,0,0,0;
   0,0,0,0,0,0,0,0,0,0;
   0,0,0,0,0,0,0,0,0,0;
   0,0,0,0,0,0,1,0,0,0;
   0,0,0,0,0,0,0,1,0,0];
B=[1,0;0,1;0,0;0,0;0,0;0,0;1,0;0,1;0,0;0,0];
C=[1,0,0,0,0,0,0,0,0,0;0,1,0,0,0,0,0,0,0,0];
D=[0,0;0,0];
assert_checkequal(Sn.A,A);
assert_checkequal(Sn.B,B);
assert_checkequal(Sn.C,C);
assert_checkequal(Sn.D,D);