1
<?xml version="1.0" encoding="UTF-8"?>
2
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="remezb">
4
<refname>remezb</refname>
5
<refpurpose> Minimax approximation of magnitude response</refpurpose>
8
<title>Calling Sequence</title>
9
<synopsis>[an]=remezb(nc,fg,ds,wt)</synopsis>
12
<title>Arguments</title>
17
<para>Number of cosine functions</para>
23
<para>Grid of frequency points in [0,.5)</para>
30
Desired magnitude on grid <literal>fg</literal>
38
Weighting function on error on grid <literal>fg</literal>
45
<para>Cosine filter coefficients</para>
51
<title>Description</title>
53
Minimax approximation of a frequency domain
54
magnitude response. The approximation takes
55
the form <literal>h = sum[a(n)*cos(wn)]</literal>
56
for n=0,1,...,nc. An FIR, linear-phase filter
57
can be obtained from the output of the function
58
by using the following commands
60
<programlisting role=""><![CDATA[
61
hn(1:nc-1)=an(nc:-1:2)/2;
63
hn(nc+1:2*nc-1)=an(2:nc)/2;
67
<title>Examples</title>
68
<programlisting role="example"><![CDATA[
69
// Choose the number of cosine functions and create a dense grid
70
// in [0,.24) and [.26,.5)
72
fg=.24*(0:ngrid/2-1)/(ngrid/2-1);
73
fg(ngrid/2+1:ngrid)=fg(1:ngrid/2)+.26*ones(1:ngrid/2);
75
// Specify a low pass filter magnitude for the desired response
76
ds(1:ngrid/2)=ones(1:ngrid/2);
77
ds(ngrid/2+1:ngrid)=zeros(1:ngrid/2);
79
// Specify a uniform weighting function
83
an=remezb(nc,fg,ds,wt)
85
// Make a linear phase FIR filter
86
hn(1:nc-1)=an(nc:-1:2)/2;
88
hn(nc+1:2*nc-1)=an(2:nc)/2;
90
// Plot the filter's magnitude response
91
plot(.5*(0:255)/256,frmag(hn,256));
93
// Choose the number of cosine functions and create a dense grid in [0,.5)
95
fg=.5*(0:(ngrid-1))/ngrid;
97
// Specify a triangular shaped magnitude for the desired response
98
ds(1:ngrid/2)=(0:ngrid/2-1)/(ngrid/2-1);
99
ds(ngrid/2+1:ngrid)=ds(ngrid/2:-1:1);
101
// Specify a uniform weighting function
105
an=remezb(nc,fg,ds,wt)
107
// Make a linear phase FIR filter
108
hn(1:nc-1)=an(nc:-1:2)/2;
110
hn(nc+1:2*nc-1)=an(2:nc)/2;
112
// Plot the filter's magnitude response
113
plot(.5*(0:255)/256,frmag(hn,256));
116
<refsection role="see also">
117
<title>See Also</title>
118
<simplelist type="inline">
120
<link linkend="eqfir">eqfir</link>