Mercurial > hg > ltpda
view m-toolbox/html_help/help/ug/interp.html @ 21:8be9deffe989 database-connection-manager
Update ltpda_uo.update
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html lang="en"> <head> <meta name="generator" content= "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org"> <meta http-equiv="Content-Type" content= "text/html; charset=us-ascii"> <title>Interpolating data (LTPDA Toolbox)</title> <link rel="stylesheet" href="docstyle.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.52.2"> <meta name="description" content= "Presents an overview of the features, system requirements, and starting the toolbox."> </head> <body> <a name="top_of_page" id="top_of_page"></a> <p style="font-size:1px;"> </p> <table class="nav" summary="Navigation aid" border="0" width= "100%" cellpadding="0" cellspacing="0"> <tr> <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td> <td valign="baseline" align="right"><a href= "resample.html"><img src="b_prev.gif" border="0" align= "bottom" alt="Resampling data"></a> <a href= "spikeclean.html"><img src="b_next.gif" border="0" align= "bottom" alt="Spikes reduction in data"></a></td> </tr> </table> <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Interpolating data</h1> <hr> <p> <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"> </p> <br> <br> <table class="nav" summary="Navigation aid" border="0" width= "100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td align="left" width="20"><a href="resample.html"><img src= "b_prev.gif" border="0" align="bottom" alt= "Resampling data"></a> </td> <td align="left">Resampling data</td> <td> </td> <td align="right">Spikes reduction in data</td> <td align="right" width="20"><a href= "spikeclean.html"><img src="b_next.gif" border="0" align= "bottom" alt="Spikes reduction in data"></a></td> </tr> </table><br> <p class="copy">©LTP Team</p> </body> </html>