File: fsfir.sci

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (34 lines) | stat: -rw-r--r-- 1,062 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
function [hst]=fsfir(hd,flag)
//<hst>=fsfir(hd,flag)
//macro for the design of FIR, linear phase filters
//using the frequency sampling technique
//  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 the chosen grid of frequencies
//!
//author: G. Le Vey  Date: 1 Febr. 1989
// Copyright INRIA

   n1=prod(size(hd));//filter length
   if flag==1 then
   hst=hd(1)*dirich(n,0,flag);
   for j=1:n1-1,if hd(j+1)<>0,..
   hst=hst+hd(j+1)*(dirich(n,j,flag)+dirich(n,-j,flag));end;end
   else
   if n1==n/2 then
   hst=hd(1)*(dirich(n,.5,1)+dirich(n,-.5,1));
   for j=2:n1,if hd(j)<>0,..
   hst=hst+hd(j)*(dirich(n,j-1,flag)+dirich(n,-j+1,flag));end;end
   else
   hst=hd(n1)*dirich(n,0,1);
   hst=hst+hd(1)*(dirich(n,.5,1)+dirich(n,-.5,1));
   for j=2:n1-1,if hd(j)<>0,..
   hst=hst+hd(j)*(dirich(n,j-1,flag)+dirich(n,-j+1,flag));end;end
   end
   end

function [bidon]=dirich(n,p,q)
bidon=0.5;