0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % MKBANDREJECT return a low pass filter miir(). A Butterworth filter is used.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: MKBANDREJECT return a low pass filter miir().
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % A Butterworth filter is used.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % CALL: f = mkbandreject(f, pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % VERSION: $Id: mkbandreject.m,v 1.11 2011/04/04 11:37:02 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 function f = mkbandreject(f, pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 g = find(pl, 'gain');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 fc = find(pl, 'fc');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 fs = find(pl, 'fs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 order = find(pl, 'order');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 ripple = find(pl, 'ripple');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 utils.helper.checkFilterOptions(pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % Build filter coefficients
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 [a, b] = cheby1(order, ripple, 2.*fc./fs, 'stop');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 % Set filter properties
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 f.name = 'bandreject';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 f.fs = fs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 f.a = g.*a;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 f.b = b;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 f.histin = zeros(1,f.ntaps-1); % initialise input history
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 f.histout = zeros(1,f.ntaps-1); % initialise output history
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34
|