~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to man/signal/remezb.cat

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
remezb            Scilab Group            Scilab Function            remezb
 
2
NAME
 
3
   remezb - Minimax approximation of magnitude response
 
4
  
 
5
CALLING SEQUENCE
 
6
 [an]=remezb(nc,fg,ds,wt)
 
7
PARAMETERS
 
8
 nc   : Number of cosine functions
 
9
      
 
10
 fg   : Grid of frequency points in [0,.5)
 
11
      
 
12
 ds   : Desired magnitude on grid fg
 
13
      
 
14
 wt   : Weighting function on error on grid fg
 
15
      
 
16
 an   : Cosine filter coefficients
 
17
      
 
18
DESCRIPTION
 
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
 
23
  
 
24
          hn(1:nc-1)=an(nc:-1:2)/2;
 
25
          hn(nc)=an(1);
 
26
          hn(nc+1:2*nc-1)=an(2:nc)/2;
 
27
EXAMPLE
 
28
 // Choose the number of cosine functions and create a dense grid 
 
29
 // in [0,.24) and [.26,.5)
 
30
 nc=21;ngrid=nc*16;
 
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
 
37
 wt=ones(fg);
 
38
 // Run remezb
 
39
 an=remezb(nc,fg,ds,wt)
 
40
 // Make a linear phase FIR filter 
 
41
 hn(1:nc-1)=an(nc:-1:2)/2;
 
42
 hn(nc)=an(1);
 
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));
 
46
 //////////////
 
47
 // Choose the number of cosine functions and create a dense grid in [0,.5)
 
48
 nc=21; ngrid=nc*16;
 
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
 
54
 wt=ones(fg);
 
55
 // Run remezb
 
56
 an=remezb(nc,fg,ds,wt)
 
57
 // Make a linear phase FIR filter 
 
58
 hn(1:nc-1)=an(nc:-1:2)/2;
 
59
 hn(nc)=an(1);
 
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));
 
63
AUTHOR
 
64
   C. B.
 
65
  
 
66
SEE ALSO
 
67
   eqfir
 
68