comparison m-toolbox/html_help/help/ug/sigproc_fir_content.html @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 <p>
2 Finite Impulse Response filters are those filters present a non-zero finite length response
3 when excited with a very brief (ideally an infinite peak) input signal. A linear causal
4 FIR filter can be described by the following difference equation
5 </p>
6 <div align="center">
7 <IMG src="images/sigproc_8.png" width="157" height="56" align="middle" border="0">
8 </div>
9 <p>
10 This operation describe a nonrecursive system, i.e. a system that only depends on current
11 and past samples of the input data stream <tt>x[n]</tt>
12 </p>
13 <h2><a name="FIRbuild">Creating a FIR filter in the LTPDA</a></h2>
14 <p>
15 The LTPDA Toolbox allows the implementation of FIR filters by means of the
16 <a href="class_desc_mfir.html"> mfir class</a>.
17 </p>
18 <h2><a name="FIRplist">Creating from a plist</a></h2>
19 <p>
20 The following example creates an order 64 highpass filter with high frequency gain 2.
21 The filter is designed for 1 Hz sampled data and has a cut-off frequency of 0.2 Hz.
22 </p>
23 <div class="fragment"><pre>
24
25 pl = plist(<span class="string">'type'</span>, <span class="string">'highpass'</span>, ...
26 <span class="string">'order'</span>, 64, ...
27 <span class="string">'gain'</span>, 2.0, ...
28 <span class="string">'fs'</span>, 1, ...
29 <span class="string">'fc'</span>, 0.2);
30 f = mfir(pl)
31 </pre></div>
32
33 <h2><a name="FIRdiff">Creating from a difference equation</a></h2>
34 <p>
35 The filter can be defined in terms of two vectors specifying the coefficients of the filter
36 and the sampling frequency. The following example creates a FIR filter with sampling frequency
37 1 Hz and the following recursive equation:
38 </p>
39
40 <div align="center">
41 <IMG src="images/sigproc_10.png" width="202" height="28" align="middle" border="0"></div>
42 </div>
43
44 <p><br></p>
45
46 <div class="fragment"><pre>
47
48 b = [-0.8 10];
49 fs = 1;
50 f = mfir(b,fs)
51 </pre></div>
52
53 <h2><a name="FIRfromAO">Creating from an Analysis Object</a></h2>
54 <p>
55 A FIR filter can be generated based on the magnitude of the input Analysis Object or fsdata object.
56 In the following example a fsdata object is first generated and then passed to the mfir constructor
57 to obtain the equivalent FIR filter.
58 </p>
59
60 <div class="fragment"><pre>
61
62 fs = 10; <span class="comment">% sampling frequency</span>
63 f = linspace(0, fs/2, 1000);
64 y = 1./(1+(0.1*2*pi*f).^2); <span class="comment">% an arbitrary function</span>
65 fsd = fsdata(f,y,fs); <span class="comment">% build the fsdata object</span>
66 f = mfir(ao(fsd));
67
68 </pre></div>
69 <br>
70 <p>
71 Available methods for this option are: 'frequency-sampling' (uses fir2), 'least-squares' (uses firls)
72 and 'Parks-McClellan' (uses firpm)
73 </p>
74 <h2><a name="IIRimport">Importing an existing model</a></h2>
75 <p>
76 The mfir constructor also accepts as an input existing models in different formats:
77 </p>
78 <li>
79 <li><p>LISO files:<p>
80 <div class="fragment"><pre>
81 f = mfir(<span class="string">'foo_fir.fil'</span>)
82 </pre></div>
83 </li>
84 <li><p>XML files:</p>
85 <div class="fragment"><pre>
86 f = mfir(<span class="string">'foo_fir.xml'</span>)
87 </pre></div>
88 <li><p>MAT files:</p>
89 <div class="fragment"><pre>
90 f = mfir(<span class="string">'foo_fir.mat'</span>)
91 </pre></div>
92 </li>
93 <li><p>From repository:</p>
94 <div class="fragment"><pre>
95 f = mfir(plist(<span class="string">'hostname'</span>, <span class="string">'localhost'</span>, <span class="string">'database'</span>, <span class="string">'ltpda'</span>, <span class="string">'ID'</span>, []))
96 </pre></div>
97 </li>
98 </ul>