Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/interp.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>Interpolating 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 "resample.html"><img src="b_prev.gif" border="0" align= | |
30 "bottom" alt="Resampling data"></a> <a href= | |
31 "spikeclean.html"><img src="b_next.gif" border="0" align= | |
32 "bottom" alt="Spikes reduction in data"></a></td> | |
33 </tr> | |
34 </table> | |
35 | |
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Interpolating data</h1> | |
37 <hr> | |
38 | |
39 <p> | |
40 <h2>Description</h2> | |
41 <p> | |
42 Interpolation of data can be done in the LTPDA Toolbox by means of | |
43 <a href="matlab:doc('ao/interp')"><tt>interp</tt></a>. | |
44 This function interpolates the values in the input AO(s) at new values specified by the | |
45 input parameter list. | |
46 </p> | |
47 <p> | |
48 <a href="matlab:doc('ao/interp')"><tt>Interp</tt></a> overloads <tt>interp1</tt> function of | |
49 Matlab Signal Processing Toolbox for AOs. | |
50 </p> | |
51 <br> | |
52 <br> | |
53 <h2>Syntax</h2> | |
54 </p> | |
55 <div class="fragment"><pre> | |
56 <br> | |
57 b = interpolate(a, pl) | |
58 </pre> | |
59 </div> | |
60 <h2>Parameters</h2> | |
61 <p> | |
62 The following parameters can be set in the method: | |
63 <ul> | |
64 <li> <tt>vertices</tt> - specify the new vertices to interpolate on </li> | |
65 <li> <tt>method</tt> - four methods are available for interpolating data</li> | |
66 <ul> | |
67 <li> 'nearest'- nearest neighbor interpolation </li> | |
68 <li> 'linear' - linear interpolation </li> | |
69 <li> 'spline' - spline interpolation (default option) </li> | |
70 <li> 'cubic' - shape-preserving piecewise cubic interpolation </li> | |
71 </ul> | |
72 </ul> | |
73 For details see <tt>interp1</tt> help of Matlab. | |
74 </p> | |
75 <p> | |
76 <h2>Examples</h2> | |
77 </p> | |
78 <p> | |
79 1. Interpolation of a sequence of random data at original sampling rate of 1 Hz | |
80 by a factor of 10 with no initial phase. | |
81 </p> | |
82 <div class="fragment"><pre> | |
83 <br> | |
84 <span class="comment">% Signal generation</span> | |
85 pl = plist(<span class="string">'tsfcn'</span>,<span class="string">'sin(2*pi*1.733*t)'</span>,... | |
86 <span class="string">'fs'</span>,1,<span class="string">'nsecs'</span>,10,... | |
87 <span class="string">'yunits'</span>,<span class="string">'V'</span>); | |
88 x = ao(pl); | |
89 <span class="comment">% Interpolate on a new time vector</span> | |
90 t = linspace(0, x.data.nsecs - 1/x.data.fs, 2*len(x)); | |
91 pl_spline = plist(<span class="string">'vertices'</span>,t); | |
92 pl_nearest = plist(<span class="string">'vertices'</span>,t,<span class="string">'method'</span>,<span class="string">'nearest'</span>); | |
93 x_spline = interp(x,pl_spline); | |
94 x_nearest = interp(x,pl_nearest); | |
95 iplot([x x_spline x_nearest], plist(<span class="string">'Markers'</span>, {<span class="string">'x'</span>, <span class="string">'o'</span>, <span class="string">'+'</span>}, ... | |
96 <span class="string">'LineColors'</span>, {<span class="string">'k'</span>, <span class="string">'r'</span>})); | |
97 </pre> | |
98 </div> | |
99 <br> | |
100 <br> | |
101 <img src="images/interp.png" alt="Interpolate" border="0"> | |
102 | |
103 </p> | |
104 | |
105 <br> | |
106 <br> | |
107 <table class="nav" summary="Navigation aid" border="0" width= | |
108 "100%" cellpadding="0" cellspacing="0"> | |
109 <tr valign="top"> | |
110 <td align="left" width="20"><a href="resample.html"><img src= | |
111 "b_prev.gif" border="0" align="bottom" alt= | |
112 "Resampling data"></a> </td> | |
113 | |
114 <td align="left">Resampling data</td> | |
115 | |
116 <td> </td> | |
117 | |
118 <td align="right">Spikes reduction in data</td> | |
119 | |
120 <td align="right" width="20"><a href= | |
121 "spikeclean.html"><img src="b_next.gif" border="0" align= | |
122 "bottom" alt="Spikes reduction in data"></a></td> | |
123 </tr> | |
124 </table><br> | |
125 | |
126 <p class="copy">©LTP Team</p> | |
127 </body> | |
128 </html> |