Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/resample.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 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> | |
3 | |
4 <html lang="en"> | |
5 <head> | |
6 <meta name="generator" content= | |
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org"> | |
8 <meta http-equiv="Content-Type" content= | |
9 "text/html; charset=us-ascii"> | |
10 | |
11 <title>Resampling data (LTPDA Toolbox)</title> | |
12 <link rel="stylesheet" href="docstyle.css" type="text/css"> | |
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2"> | |
14 <meta name="description" content= | |
15 "Presents an overview of the features, system requirements, and starting the toolbox."> | |
16 </head> | |
17 | |
18 <body> | |
19 <a name="top_of_page" id="top_of_page"></a> | |
20 | |
21 <p style="font-size:1px;"> </p> | |
22 | |
23 <table class="nav" summary="Navigation aid" border="0" width= | |
24 "100%" cellpadding="0" cellspacing="0"> | |
25 <tr> | |
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td> | |
27 | |
28 <td valign="baseline" align="right"><a href= | |
29 "upsample.html"><img src="b_prev.gif" border="0" align= | |
30 "bottom" alt="Upsampling data"></a> <a href= | |
31 "interp.html"><img src="b_next.gif" border="0" align= | |
32 "bottom" alt="Interpolating data"></a></td> | |
33 </tr> | |
34 </table> | |
35 | |
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Resampling data</h1> | |
37 <hr> | |
38 | |
39 <p> | |
40 <h2>Description</h2> | |
41 <p> | |
42 Resampling is the process of changing the sampling rate of data. <a href="matlab:doc('ao/resample')"><tt>Resample</tt></a> | |
43 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. | |
44 </p> | |
45 <h2>Syntax</h2> | |
46 <div class="fragment"><pre> | |
47 <br> | |
48 b = resample(a, pl) | |
49 </pre> | |
50 </div> | |
51 <h2>Parameters</h2> | |
52 <p> The following parameters can be set: | |
53 <ul> | |
54 <li> <tt>fsout</tt> - specify the desired output frequency (must be positive and integer)</li> | |
55 <li> <tt>filter</tt> - specified filter applied to the input, <tt>a</tt>, in the resampling process</li> | |
56 </ul> | |
57 </p> | |
58 <p> | |
59 <h2>Examples</h2> | |
60 </p> | |
61 <p> | |
62 2. Resampling a sequence of random data at original sampling rate of 1 Hz at an output sampling of 50 Hz. | |
63 </p> | |
64 <div class="fragment"><pre> | |
65 <br> | |
66 <span class="comment">% create an AO of random data with fs = 10 Hz</span> | |
67 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); | |
68 x = ao(pl); | |
69 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> | |
70 iplot(x, y) <span class="comment">% plot original and resampled data</span> | |
71 </pre> | |
72 </div> | |
73 <br> | |
74 <br> | |
75 <img src="images/resample1.png" alt="Resample"> | |
76 <br> | |
77 <br> | |
78 <br> | |
79 <p> | |
80 1. Resampling a sequence of random data at original sampling rate of 10 Hz at an output sampling of 1 Hz with | |
81 a filter defined by the user. | |
82 </p> | |
83 <div class="fragment"><pre> | |
84 <br> | |
85 <span class="comment">% create an AO of random data with fs = 10 Hz</span> | |
86 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>); | |
87 x = ao(pl) | |
88 | |
89 <span class="comment">% filter definition</span> | |
90 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); | |
91 f = mfir(plfilter) | |
92 | |
93 <span class="comment">% resampling</span> | |
94 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> | |
95 y = resample(x, pl); <span class="comment">% resample the input AO (x) to obtain the resampled output AO (y)</span> | |
96 iplot(x, y) <span class="comment">% plot original and resampled data</span> | |
97 </pre> | |
98 </div> | |
99 <br> | |
100 <br> | |
101 <img src="images/resample2.png" alt="Resample" border="0"> | |
102 | |
103 | |
104 | |
105 </p> | |
106 | |
107 <br> | |
108 <br> | |
109 <table class="nav" summary="Navigation aid" border="0" width= | |
110 "100%" cellpadding="0" cellspacing="0"> | |
111 <tr valign="top"> | |
112 <td align="left" width="20"><a href="upsample.html"><img src= | |
113 "b_prev.gif" border="0" align="bottom" alt= | |
114 "Upsampling data"></a> </td> | |
115 | |
116 <td align="left">Upsampling data</td> | |
117 | |
118 <td> </td> | |
119 | |
120 <td align="right">Interpolating data</td> | |
121 | |
122 <td align="right" width="20"><a href= | |
123 "interp.html"><img src="b_next.gif" border="0" align= | |
124 "bottom" alt="Interpolating data"></a></td> | |
125 </tr> | |
126 </table><br> | |
127 | |
128 <p class="copy">©LTP Team</p> | |
129 </body> | |
130 </html> |