0aafdcdd4345906549a5ee63643705c837d45454
[scilab.git] / scilab / modules / signal_processing / tests / unit_tests / remez.tst
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2011 - DIGITEO
3 //
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution.  The terms
7 // are also available at    
8 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
9
10 iext = linspace(1,5,5);
11 ds = [ones(1:5),zeros(1:5)];
12 fg = linspace(0,0.5,10);
13 wt = ones(fg);
14 y = remez(iext,ds,fg,wt);
15
16 if max(abs(y - [0.500 0.852 0.000 0.000])) > 0.001 then pause, end
17
18
19 nc=21;
20 ngrid=nc*250;
21 fgrid=.5*(0:(ngrid-1))/(ngrid-1);
22 mag=ones(1:ngrid/2);
23 mag(ngrid/2+1:ngrid)=0*ones(1:ngrid/2);
24 weight=ones(fgrid);
25 guess=round(1:ngrid/nc:ngrid);
26 guess(nc+1)=ngrid;
27 guess(nc+2)=ngrid;
28 an=remez(guess,mag,fgrid,weight);