diff m-toolbox/html_help/help/ug/interp_content.html @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/html_help/help/ug/interp_content.html	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,62 @@
+<h2>Description</h2>
+<p>
+  Interpolation of data can be done in the LTPDA Toolbox by means of
+  <a href="matlab:doc('ao/interp')"><tt>interp</tt></a>.
+  This function interpolates the values in the input AO(s) at new values specified by the
+  input parameter list.
+</p>
+<p>
+  <a href="matlab:doc('ao/interp')"><tt>Interp</tt></a> overloads <tt>interp1</tt> function of
+  Matlab Signal Processing Toolbox for AOs.
+</p>
+<br>
+<br>
+<h2>Syntax</h2>
+</p>
+<div class="fragment"><pre>
+    <br>
+    b = interpolate(a, pl)
+  </pre>
+</div>
+<h2>Parameters</h2>
+<p>
+  The following parameters can be set in the method:
+  <ul>
+    <li> <tt>vertices</tt> - specify the new vertices to interpolate on </li>
+    <li> <tt>method</tt> - four methods are available for interpolating data</li>
+    <ul>
+      <li> 'nearest'- nearest neighbor interpolation </li>
+      <li> 'linear' - linear interpolation </li>
+      <li> 'spline' - spline interpolation (default option) 	</li>
+      <li> 'cubic' - shape-preserving piecewise cubic interpolation </li>
+    </ul>
+  </ul>
+  For details see <tt>interp1</tt> help of Matlab.
+</p>
+<p>
+  <h2>Examples</h2>
+</p>
+<p>
+  1. Interpolation of a sequence of random data at original sampling rate of 1 Hz
+  by a factor of 10 with no initial phase.
+</p>
+<div class="fragment"><pre>
+    <br>
+    <span class="comment">% Signal generation</span>
+    pl = plist(<span class="string">'tsfcn'</span>,<span class="string">'sin(2*pi*1.733*t)'</span>,...
+    <span class="string">'fs'</span>,1,<span class="string">'nsecs'</span>,10,...
+    <span class="string">'yunits'</span>,<span class="string">'V'</span>);
+    x = ao(pl);
+    <span class="comment">% Interpolate on a new time vector</span>
+    t = linspace(0, x.data.nsecs - 1/x.data.fs, 2*len(x));
+    pl_spline  = plist(<span class="string">'vertices'</span>,t);
+    pl_nearest = plist(<span class="string">'vertices'</span>,t,<span class="string">'method'</span>,<span class="string">'nearest'</span>);
+    x_spline   = interp(x,pl_spline);
+    x_nearest  = interp(x,pl_nearest);
+    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>}, ...
+    <span class="string">'LineColors'</span>, {<span class="string">'k'</span>, <span class="string">'r'</span>}));
+  </pre>
+</div>
+<br>
+<br>
+<img src="images/interp.png" alt="Interpolate" border="0">