summaryrefslogtreecommitdiffstats
path: root/scilab/modules/cacsd/tests/unit_tests/arma.dia.ref
blob: 8b6537330118b97592eedf72ca32b862b2124bff (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
// y_{n+1} = y_n + 2*y_{n-1} + [1,2,3]*U_{n+1} + sig*1*e_{n+1}
Ar=armac([1,-1,-2],[1,2,3],[1],1,3,0);
u= (1:4).*.ones(3,1);
y1=arsimul(Ar,u);
if y1<>[6,18,48,108] then bugmes();quit;end
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
a=rand('seed');
Ar('sig')=1;
y1=arsimul(Ar,u);
rand('seed',a);
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
// y_{n+1} = y_n + 2*y_{n-1} + [1,2,3]*U_{n} + sig*1*e_{n+1}
Ar=armac([1,-1,-2],[0,0,0,1,2,3],[1],1,3,0);
u= (1:4).*.ones(3,1);
y1=arsimul(Ar,u);
if y1<>[0,6,18,48] then bugmes();quit;end
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
a=rand('seed');
Ar('sig')=1;
y1=arsimul(Ar,u);
rand('seed',a);
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
// y_{n+1} = y_n + 2*y_{n-1} + [1,2,3]*U_{n+1} -[4,5,6]*U_{n}+[7,8,9]*U_{n-1} + sig*1*e_{n+1}
Ar=armac([1,-1,-2],[1,2,3,-4,-5,-6,7,8,9],[1],1,3,0);
u= (1:4).*.ones(3,1);
y1=arsimul(Ar,u);
if y1<>[6,3,27,60] then bugmes();quit;end
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
a=rand('seed');
Ar('sig')=1;
y1=arsimul(Ar,u);
rand('seed',a);
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
// y_{n+1} = eye(2,2)*y_n + 2*eye(2,2)*y_{n-1} + [1,2,3;1,2,3]*U_{n+1} -[4,5,6;4,5,6]*U_{n}
//		+[7,8,9;7,8,9]*U_{n-1} + sig*eye(2,2)*e_{n+1}
Ar=armac([1,-1,-2].*.eye(2,2),[1,2,3,-4,-5,-6,7,8,9].*.[1;1],[eye(2,2)],2,3,0);
u= (1:4).*.ones(3,1);
y1=arsimul(Ar,u);
if y1<>[6,3,27,60].*.[1;1] then bugmes();quit;end
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
a=rand('seed');
Ar('sig')=1;
y1=arsimul(Ar,u);
rand('seed',a);
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
// y_{n+1} = ones(2,2)*y_n + 2*ones(2,2)*y_{n-1} + [1,2,3;1,2,3]*U_{n+1} -[4,5,6;4,5,6]*U_{n}
//		+[7,8,9;7,8,9]*U_{n-1} + sig*eye(2,2)*e_{n+1}
Ar=armac([eye(2,2),-ones(2,2),-2*ones(2,2)],[1,2,3,-4,-5,-6,7,8,9].*.[1;1],[eye(2,2)],2,3,0);
u= (1:4).*.ones(3,1);
y1=arsimul(Ar,u);
if y1<>[6,9,54,171].*.[1;1] then bugmes();quit;end
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
a=rand('seed');
Ar('sig')=1;
y1=arsimul(Ar,u);
rand('seed',a);
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;
// y_{n+1} = ones(2,2)*y_n + 2*ones(2,2)*y_{n-1} + [1,2,3;1,2,3]*U_{n+1} -[4,5,6;4,5,6]*U_{n}
//		+[7,8,9;7,8,9]*U_{n-1} + sig*D*e_{n+1}
// D=rand(2,10)
D=rand(2,10);
Ar=armac([eye(2,2),-ones(2,2),-2*ones(2,2)],[1,2,3,-4,-5,-6,7,8,9].*.[1;1],[D],2,3,1.0);
u= (1:4).*.ones(3,1);
a=rand('seed');
y1=arsimul(Ar,u);
rand('seed',a);
y2=narsimul(Ar,u);
if y1<>y2 then bugmes();quit;end;