Increase tol parameter for Windows x64
[scilab.git] / scilab / modules / cacsd / tests / unit_tests / dscr.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2008 - INRIA - Serge Steer
4 // Copyright (C) 2011 - DIGITEO - Michael Baudin
5 //
6 //  This file is distributed under the same license as the Scilab package.
7 // =============================================================================
8 // Case #1
9 a=-1/3;
10 b=1;
11 c=1;
12 sl=syslin('c',a,b,c);
13 sld=dscr(sl,0.1);
14 assert_checkalmostequal ( sld.dt , 0.1 , %eps );
15 computed = sld.A;
16 expected = exp(sl.A*0.1);
17 assert_checkalmostequal ( computed , expected , %eps );
18 computed = sld.B;
19 expected = sl.A\(sld.A-eye())*sl.B;
20 assert_checkalmostequal ( computed , expected , %eps );
21 // Case #2
22 a=[0.9,0,0.6,-1.4,-4.2;
23    0.2,0.1,-0.2,0.5,0.6;
24    -4.3,0,2.2,0,2.4;
25    -3.7,-0.5,2.4,-0.6,2.7;
26    6.4,0.1,-4,-0.5,-4];
27 b=[-0.1,-0.1,0;
28    0,0,0.1;
29    -0.1,0.2,-0.1;
30    0.2,0.2,-0.6;
31    0.2,-0.1,0.1];
32 c=[2,7,-2,5,1
33    0,-1,3,0,2];
34 d=[1,0,0
35    0,0,0];
36 sl=syslin('c',a,b,c,d);
37 sld=dscr(sl,0.1);
38 assert_checkalmostequal ( sld.dt , 0.1 , %eps );
39 computed = sld.A;
40 expected = expm(sl.A*0.1);
41 assert_checkalmostequal ( computed , expected , %eps );
42 computed = sld.B;
43 expected = sl.A\(sld.A-eye())*sl.B;
44 assert_checkalmostequal ( computed , expected , 2.e5 * %eps );