Fix test on win64b : test_run(signal_processing, lattn)
[scilab.git] / scilab / modules / signal_processing / tests / unit_tests / lattn.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2013 - Scilab Enterprises - Charlotte Hecquet
4 // Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru
5 // Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
6 //
7 //  This file is distributed under the same license as the Scilab package.
8 // =============================================================================
9 //Generate the process
10 t1=0:0.1:100;
11 y1=sin(2*%pi*t1)+sin(2*%pi*2*t1);
12 //Covariance of y1
13 nlag=128;
14 c1=corr(y1,nlag);
15 c1=c1';
16 //Compute the filter with maximum order=15 and p=1
17 n=5;
18 [la1,sig1]=lattn(n,1,c1);
19 poly(0,"z");
20 expected = [1, 0.4429775275224619446313];
21 computed = coeff(la1(1));
22 assert_checkalmostequal(computed, expected, 1.e-14);
23 expected = [1, -0.7424151347904438535963, 0.6626546432402768971315];
24 computed = coeff(la1(2));
25 assert_checkalmostequal(computed, expected, 1.e-14);
26 expected = [1, -0.7483090096409563685143, 0.6686337968594154856916, -0.0048019603017336104020];
27 computed = coeff(la1(3));
28 assert_checkalmostequal(computed, expected, 1.e-11);
29 expected = [1, -2.259216884889600152064, 3.0129744887444243062191, -2.2463220443824241101538, 0.9961140979715100707281];
30 computed = coeff(la1(4));
31 assert_checkalmostequal(computed, expected, 1.e-13);
32 expected = [1, -1.8328746888034248563315, 2.0881496310317460007866, -1.0213063678721847615805, 0.0953432301271536220000, 0.3993857757876373426598];
33 computed = coeff(la1(5));
34 assert_checkalmostequal(computed, expected, 1.e-10);
35 expected = [-1.7888543819998343753497, 1];
36 computed = coeff(sig1(1));
37 assert_checkalmostequal(computed, expected, 1.e-14);
38 expected = [1.2273893327241232054092, -1.2451484900822573642643, 1];
39 computed = coeff(sig1(2));
40 assert_checkalmostequal(computed, expected, 1.e-14);
41 expected = [-1.5168020192922293531979, 2.3534861083273810322680, -2.2502643910424811046767, 1];
42 computed = coeff(sig1(3));
43 assert_checkalmostequal(computed, expected, 1.e-13);
44 expected = [1.0674946929328583689056, -2.3156179157577936322809, 3.0672491379903537023210, -2.255390458180256185727, 1];
45 computed = coeff(sig1(4));
46 assert_checkalmostequal(computed, expected, 1.e-12);
47 expected = [1.4523203295727387107661, -2.2136119179063014072995, 2.0601861867297621699890, -0.1951300338336365847169, -0.8087137031222213501280, 1];
48 computed = coeff(sig1(5));
49 assert_checkalmostequal(computed, expected, 1.e-10);
50 //Compare result of poles with p=-1 and with levin function
51 [la2,sig2]=lattn(n,-1,c1);
52 expected = [1, -1.7888543819998343753497];
53 computed = coeff(la2(1));
54 assert_checkalmostequal(computed, expected, 1.e-14);
55 expected = [1, -1.2451484900822573642643, 1.2273893327241232054092];
56 computed = coeff(la2(2));
57 assert_checkalmostequal(computed, expected, 1.e-14);
58 expected = [1, -2.25026439104248154877, 2.3534861083273810322680, -1.5168020192922295752425];
59 computed = coeff(la2(3));
60 assert_checkalmostequal(computed, expected, 1.e-13);
61 expected = [1, -2.2553904581802566298165, 3.0672491379903545904995, -2.3156179157577940763701, 1.0674946929328590350394];
62 computed = coeff(la2(4));
63 assert_checkalmostequal(computed, expected, 1.e-12);
64 expected = [1, -0.8087137031221993677121, -0.1951300338336872108869, 2.0601861867298310038166, -2.2136119179063538098262, 1.4523203295727622474942];
65 computed = coeff(la2(5));
66 assert_checkalmostequal(computed, expected, 1.e-10);
67 expected = [0.4429775275224624442316, 1];
68 computed = coeff(sig2(1));
69 assert_checkalmostequal(computed, expected, 1.e-14);
70 expected = [0.6626546432402768971315, -0.7424151347904438535963, 1];
71 computed = coeff(sig2(2));
72 assert_checkalmostequal(computed, expected, 1.e-14);
73 expected = [-0.0048019603017336104020, 0.6686337968594154856916, -0.7483090096409563685143, 1];
74 computed = coeff(sig2(3));
75 assert_checkalmostequal(computed, expected, 1.e-11);
76 expected = [0.9961140979715094045943, -2.2463220443824232219754, 3.0129744887444229739515, -2.2592168848895997079751, 1];
77 computed = coeff(sig2(4));
78 assert_checkalmostequal(computed, expected, 1.e-13);
79 expected = [0.3993857757876351222137, 0.0953432301271577298252, -1.0213063678721903126956, 2.0881496310317495535003, -1.8328746888034264106437, 1];
80 computed = coeff(sig2(5));
81 assert_checkalmostequal(computed, expected, 1.e-10);