1
remezb Scilab Group Scilab Function remezb
3
remezb - Minimax approximation of magnitude response
6
[an]=remezb(nc,fg,ds,wt)
8
nc : Number of cosine functions
10
fg : Grid of frequency points in [0,.5)
12
ds : Desired magnitude on grid fg
14
wt : Weighting function on error on grid fg
16
an : Cosine filter coefficients
19
Minimax approximation of a frequency domain magnitude response. The
20
approximation takes the form h = sum[a(n)*cos(wn)] for n=0,1,...,nc. An
21
FIR, linear-phase filter can be obtained from the the output of the
22
function by using the following commands
24
hn(1:nc-1)=an(nc:-1:2)/2;
26
hn(nc+1:2*nc-1)=an(2:nc)/2;
28
// Choose the number of cosine functions and create a dense grid
29
// in [0,.24) and [.26,.5)
31
fg=.24*(0:ngrid/2-1)/(ngrid/2-1);
32
fg(ngrid/2+1:ngrid)=fg(1:ngrid/2)+.26*ones(1:ngrid/2);
33
// Specify a low pass filter magnitude for the desired response
34
ds(1:ngrid/2)=ones(1:ngrid/2);
35
ds(ngrid/2+1:ngrid)=zeros(1:ngrid/2);
36
// Specify a uniform weighting function
39
an=remezb(nc,fg,ds,wt)
40
// Make a linear phase FIR filter
41
hn(1:nc-1)=an(nc:-1:2)/2;
43
hn(nc+1:2*nc-1)=an(2:nc)/2;
44
// Plot the filter's magnitude response
45
plot(.5*(0:255)/256,frmag(hn,256));
47
// Choose the number of cosine functions and create a dense grid in [0,.5)
49
fg=.5*(0:(ngrid-1))/ngrid;
50
// Specify a triangular shaped magnitude for the desired response
51
ds(1:ngrid/2)=(0:ngrid/2-1)/(ngrid/2-1);
52
ds(ngrid/2+1:ngrid)=ds(ngrid/2:-1:1);
53
// Specify a uniform weighting function
56
an=remezb(nc,fg,ds,wt)
57
// Make a linear phase FIR filter
58
hn(1:nc-1)=an(nc:-1:2)/2;
60
hn(nc+1:2*nc-1)=an(2:nc)/2;
61
// Plot the filter's magnitude response
62
plot(.5*(0:255)/256,frmag(hn,256));