File: remezfilt.dem

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (36 lines) | stat: -rw-r--r-- 947 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
////////////////////////
//MINIMAX FIR FILTERS///
////////////////////////
// Copyright INRIA
xbasc();xselect();
//Low pass filter (length 33, cut-off in [.23,.27], weight 1/.1)

   hn=eqfir(33,[0 .23;.27 .5],[1 0],[1 .1]);
   [hm,fr]=frmag(hn,256);
   plot2d(fr',hm'),
   title_c=['Minimax FIR filter';
 	  'low pass  cut-off in [.23,.27]';
          'length 33'];
   xtitle(title_c);
   halt(),xbasc();
 
//Triangular filter created using remezb
   nc=21;
   ngrid=nc*16;
   fg=.5*(0:(ngrid-1))/(ngrid-1);
   ds(1:ngrid/2)=(0:-1+ngrid/2)*2/(ngrid-2);
   ds(ngrid/2+1:ngrid)=ds(ngrid/2:-1:1);
   wt=ones(fg);
   [an]=remezb(nc,fg,ds,wt);
   hn(1:nc-1)=an(nc:-1:2)/2;
   hn(nc)=an(1);
   hn(nc+1:2*nc-1)=an(2:nc)/2;
   [hm,fr]=frmag(hn,maxi(size(ds)));
   plot2d(fr',hm'),
   xtitle('Remez Triangular filter','frequency','magnitude');
   halt();xbasc(); 
   plot2d(fr',(hm-ds)'),
   xtitle(' ','frequency','magnitude error');
   halt(),xbasc();