unit tests added
[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 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 a=-1/3;b=1;c=1;
8 sl=syslin('c',a,b,c);
9 sld=dscr(sl,0.1);
10 if sld.dt<>0.1 then bugmes();quit;end
11 if sld.A<>exp(sl.A*0.1) then bugmes();quit;end
12 if norm(sld.B-sl.A\(sld.A-eye())*sl.B)>1d-15 then bugmes();quit;end
13 a=[0.9,0,0.6,-1.4,-4.2;
14    0.2,0.1,-0.2,0.5,0.6;
15    -4.3,0,2.2,0,2.4;
16    -3.7,-0.5,2.4,-0.6,2.7;
17    6.4,0.1,-4,-0.5,-4];
18 b=[-0.1,-0.1,0;
19    0,0,0.1;
20    -0.1,0.2,-0.1;
21    0.2,0.2,-0.6;
22    0.2,-0.1,0.1];
23 c=[2,7,-2,5,1
24    0,-1,3,0,2];
25 d=[1,0,0
26    0,0,0];
27 sl=syslin('c',a,b,c,d);
28 sld=dscr(sl,0.1);
29 if sld.dt<>0.1 then bugmes();quit;end
30 if norm(sld.A-expm(sl.A*0.1))>1d-15 then bugmes();quit;end
31 if norm(sld.B-sl.A\(sld.A-eye())*sl.B)>1d-14 then bugmes();quit;end