File: fsfirlin.cat

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 (56 lines) | stat: -rw-r--r-- 1,733 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

fsfirlin(1)                    Scilab Function                    fsfirlin(1)
NAME
  fsfirlin - design of FIR, linear phase filters, frequency sampling tech-
  nique

CALLING SEQUENCE
  [hst]=fsfirlin(hd,flag)

PARAMETERS

  hd   : vector of desired frequency response samples

  flag : is equal to 1 or 2, according to the choice of type 1 or type 2
       design

  hst  : vector giving the approximated continuous response on a dense grid
       of frequencies

DESCRIPTION
  function for the design of FIR, linear phase filters using the frequency
  sampling technique

AUTHOR
  G. Le Vey

EXAMPLE
  //
  //Example of how to use the fsfirlin macro for the design
  //of an FIR filter by a frequency sampling technique.
  //
  //Two filters are designed : the first (response hst1) with
  //abrupt transitions from 0 to 1 between passbands and stop
  //bands; the second (response hst2) with one sample in each
  //transition band (amplitude 0.5) for smoothing.
  //
  hd=[zeros(1,15) ones(1,10) zeros(1,39)];//desired samples
  hst1=fsfirlin(hd,1);//filter with no sample in the transition
  hd(15)=.5;hd(26)=.5;//samples in the transition bands
  hst2=fsfirlin(hd,1);//corresponding filter
  pas=1/prod(size(hst1))*.5;
  fg=0:pas:.5;//normalized frequencies grid
  plot2d([1 1].*.fg(1:257)',[hst1' hst2']);
  // 2nd example
  hd=[0*ones(1,15) ones(1,10) 0*ones(1,39)];//desired samples
  hst1=fsfirlin(hd,1);//filter with no sample in the transition
  hd(15)=.5;hd(26)=.5;//samples in the transition bands
  hst2=fsfirlin(hd,1);//corresponding filter
  pas=1/prod(size(hst1))*.5;
  fg=0:pas:.5;//normalized frequencies grid
  n=prod(size(hst1))
  plot(fg(1:n),hst1);
  plot2d(fg(1:n)',hst2',[3],"000");

SEE ALSO
  ffilt, wfir