Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/resample_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 <h2>Description</h2> | |
2 <p> | |
3 Resampling is the process of changing the sampling rate of data. <a href="matlab:doc('ao/resample')"><tt>Resample</tt></a> | |
4 changes the sampling rate of the input AOs to the desired output sampling frequency. LTPDA <a href="matlab:doc('ao/resample')"><tt>resample</tt></a> overloads <tt>resample</tt> function of Matlab Signal Processing Toolbox for AOs. | |
5 </p> | |
6 <h2>Syntax</h2> | |
7 <div class="fragment"><pre> | |
8 <br> | |
9 b = resample(a, pl) | |
10 </pre> | |
11 </div> | |
12 <h2>Parameters</h2> | |
13 <p> The following parameters can be set: | |
14 <ul> | |
15 <li> <tt>fsout</tt> - specify the desired output frequency (must be positive and integer)</li> | |
16 <li> <tt>filter</tt> - specified filter applied to the input, <tt>a</tt>, in the resampling process</li> | |
17 </ul> | |
18 </p> | |
19 <p> | |
20 <h2>Examples</h2> | |
21 </p> | |
22 <p> | |
23 2. Resampling a sequence of random data at original sampling rate of 1 Hz at an output sampling of 50 Hz. | |
24 </p> | |
25 <div class="fragment"><pre> | |
26 <br> | |
27 <span class="comment">% create an AO of random data with fs = 10 Hz</span> | |
28 pl = plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</span>,<span class="string">'fs'</span>,1,<span class="string">'nsecs'</span>,10,<span class="string">'yunits'</span>,<span class="string">'m'</span>,<span class="string">'nsecs'</span>,100); | |
29 x = ao(pl); | |
30 y = resample(x, plist(<span class="string">'fsout'</span>, 50)); <span class="comment">% resample the input AO (x) to obtain the resampled output AO (y)</span> | |
31 iplot(x, y) <span class="comment">% plot original and resampled data</span> | |
32 </pre> | |
33 </div> | |
34 <br> | |
35 <br> | |
36 <img src="images/resample1.png" alt="Resample"> | |
37 <br> | |
38 <br> | |
39 <br> | |
40 <p> | |
41 1. Resampling a sequence of random data at original sampling rate of 10 Hz at an output sampling of 1 Hz with | |
42 a filter defined by the user. | |
43 </p> | |
44 <div class="fragment"><pre> | |
45 <br> | |
46 <span class="comment">% create an AO of random data with fs = 10 Hz</span> | |
47 pl = plist(<span class="string">'tsfcn'</span>, <span class="string">'randn(size(t))'</span>,<span class="string">'fs'</span>,10,<span class="string">'nsecs'</span>,10,<span class="string">'yunits'</span>,<span class="string">'m'</span>); | |
48 x = ao(pl) | |
49 | |
50 <span class="comment">% filter definition</span> | |
51 plfilter = plist(<span class="string">'type'</span>,<span class="string">'lowpass'</span>,<span class="string">'Win'</span>,specwin(<span class="string">'Kaiser'</span>, 10, 150),<span class="string">'order'</span>,32,<span class="string">'fs'</span>,10,<span class="string">'fc'</span>,1); | |
52 f = mfir(plfilter) | |
53 | |
54 <span class="comment">% resampling</span> | |
55 pl = plist(<span class="string">'fsout'</span>, 1, <span class="string">'filter'</span>,f); <span class="comment">% define parameters list with fsout = 1 Hz and the defined filter</span> | |
56 y = resample(x, pl); <span class="comment">% resample the input AO (x) to obtain the resampled output AO (y)</span> | |
57 iplot(x, y) <span class="comment">% plot original and resampled data</span> | |
58 </pre> | |
59 </div> | |
60 <br> | |
61 <br> | |
62 <img src="images/resample2.png" alt="Resample" border="0"> | |
63 | |
64 |