unit tests added
[scilab.git] / scilab / modules / cacsd / tests / unit_tests / dscr.tst
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 pause,end
11 if sld.A<>exp(sl.A*0.1) then pause,end
12 if norm(sld.B-sl.A\(sld.A-eye())*sl.B)>1d-15 then pause,end
13
14
15 a=[0.9,0,0.6,-1.4,-4.2;
16    0.2,0.1,-0.2,0.5,0.6;
17    -4.3,0,2.2,0,2.4;
18    -3.7,-0.5,2.4,-0.6,2.7;
19    6.4,0.1,-4,-0.5,-4];
20
21 b=[-0.1,-0.1,0;
22    0,0,0.1;
23    -0.1,0.2,-0.1;
24    0.2,0.2,-0.6;
25    0.2,-0.1,0.1];
26  
27 c=[2,7,-2,5,1
28    0,-1,3,0,2];
29 d=[1,0,0
30    0,0,0];
31
32 sl=syslin('c',a,b,c,d);
33
34 sld=dscr(sl,0.1);
35 if sld.dt<>0.1 then pause,end
36 if norm(sld.A-expm(sl.A*0.1))>1d-15 then pause,end
37 if norm(sld.B-sl.A\(sld.A-eye())*sl.B)>1d-14 then pause,end
38