<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Interpolation, least-squares fit, splines</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> > <b>C++ reference</b> </div> <div align="right"> <a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a> </div> <!-- Generated by Doxygen 1.7.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <div class="left"> <form id="FSearchBox" action="search.php" method="get"> <img id="MSearchSelect" src="search/mag.png" alt=""/> <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"/> </form> </div><div class="right"></div> </div> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">Interpolation, least-squares fit, splines</div> </div> <div class="ingroups"><a class="el" href="group__mrpt__base__grp.html">[mrpt-base]</a></div></div> <div class="contents"> <div class="dynheader"> Collaboration diagram for Interpolation, least-squares fit, splines:</div> <div class="dyncontent"> <center><table><tr><td><img src="group__interpolation__grp.png" border="0" alt="" usemap="#group____interpolation____grp"/> <map name="group____interpolation____grp" id="group____interpolation____grp"> <area shape="rect" id="node3" href="group__poses__grp.html" title="2D/3D points and poses" alt="" coords="635,7,797,33"/><area shape="rect" id="node2" href="group__mrpt__base__grp.html" title=" Back to list of all libraries | See all modules   " alt="" coords="5,7,93,33"/></map> </td></tr></table></center> </div> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1math_1_1_c_spline_interpolator1_d.html">mrpt::math::CSplineInterpolator1D</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">A (persistent) sequence of (x,y) coordinates, allowing queries of intermediate points through spline interpolation, where possible. <a href="classmrpt_1_1math_1_1_c_spline_interpolator1_d.html#details">More...</a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classmrpt_1_1poses_1_1_c_pose3_d_interpolator.html">mrpt::poses::CPose3DInterpolator</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">A trajectory in time and in 6D (<a class="el" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a>) that interpolates using splines the intervals between a set of given time-referenced poses. <a href="classmrpt_1_1poses_1_1_c_pose3_d_interpolator.html#details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memTemplParams" colspan="2">template<class T , class VECTOR > </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__interpolation__grp.html#gaeb1c0badda6737f8362ce902e10961dc">mrpt::math::interpolate</a> (const T &x, const VECTOR &ys, const T &x0, const T &x1)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximation of the sequence at the point "x". <a href="#gaeb1c0badda6737f8362ce902e10961dc"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">double BASE_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="group__interpolation__grp.html#ga199ae09bf97644048fe53590964abd1b">mrpt::math::interpolate2points</a> (const double x, const double x0, const double y0, const double x1, const double y1, bool wrap2pi=false)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1). <a href="#ga199ae09bf97644048fe53590964abd1b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">double BASE_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="group__interpolation__grp.html#gadab1f3df3e592268d89214b345f7f816">mrpt::math::spline</a> (const double t, const vector_double &x, const vector_double &y, bool wrap2pi=false)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the two middle points If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range). <a href="#gadab1f3df3e592268d89214b345f7f816"></a><br/></td></tr> <tr><td class="memTemplParams" colspan="2">template<typename NUMTYPE , class VECTORLIKE > </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">NUMTYPE </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__interpolation__grp.html#ga1e31a6d4b982eee16bab9ae66c0ee042">mrpt::math::leastSquareLinearFit</a> (const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a single point "t". <a href="#ga1e31a6d4b982eee16bab9ae66c0ee042"></a><br/></td></tr> <tr><td class="memTemplParams" colspan="2">template<class VECTORLIKE1 , class VECTORLIKE2 , class VECTORLIKE3 > </td></tr> <tr><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__interpolation__grp.html#ga4939a6f537e90519df7149c550ed71c8">mrpt::math::leastSquareLinearFit</a> (const VECTORLIKE1 &ts, VECTORLIKE2 &outs, const VECTORLIKE3 &x, const VECTORLIKE3 &y, bool wrap2pi=false)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a sequence of points "ts" and returned at "outs". <a href="#ga4939a6f537e90519df7149c550ed71c8"></a><br/></td></tr> </table> <hr/><h2>Function Documentation</h2> <a class="anchor" id="gaeb1c0badda6737f8362ce902e10961dc"></a><!-- doxytag: member="mrpt::math::interpolate" ref="gaeb1c0badda6737f8362ce902e10961dc" args="(const T &x, const VECTOR &ys, const T &x0, const T &x1)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T , class VECTOR > </div> <table class="memname"> <tr> <td class="memname">T mrpt::math::interpolate </td> <td>(</td> <td class="paramtype">const T & </td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const VECTOR & </td> <td class="paramname"><em>ys</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const T & </td> <td class="paramname"><em>x0</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const T & </td> <td class="paramname"><em>x1</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximation of the sequence at the point "x". </p> <p>If the point "x" is out of the range [x0,x1], the closest extreme "ys" value is returned. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__interpolation__grp.html#gadab1f3df3e592268d89214b345f7f816" title="Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the tw...">spline</a>, <a class="el" href="group__interpolation__grp.html#ga199ae09bf97644048fe53590964abd1b" title="Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1).">interpolate2points</a> </dd></dl> <p>Definition at line <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html#l01046">1046</a> of file <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html">base/include/mrpt/math/utils.h</a>.</p> <p>References <a class="el" href="mrpt__macros_8h_source.html#l00370">MRPT_START</a>, <a class="el" href="mrpt__macros_8h_source.html#l00282">ASSERT_</a>, and <a class="el" href="mrpt__macros_8h_source.html#l00374">MRPT_END</a>.</p> </div> </div> <a class="anchor" id="ga199ae09bf97644048fe53590964abd1b"></a><!-- doxytag: member="mrpt::math::interpolate2points" ref="ga199ae09bf97644048fe53590964abd1b" args="(const double x, const double x0, const double y0, const double x1, const double y1, bool wrap2pi=false)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">double BASE_IMPEXP mrpt::math::interpolate2points </td> <td>(</td> <td class="paramtype">const double </td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>x0</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>y0</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>x1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>y1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>wrap2pi</em> = <code>false</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1). </p> <p>If wrap2pi is true, output is wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range). </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__interpolation__grp.html#gadab1f3df3e592268d89214b345f7f816" title="Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the tw...">spline</a>, <a class="el" href="group__interpolation__grp.html#gaeb1c0badda6737f8362ce902e10961dc" title="Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximat...">interpolate</a>, <a class="el" href="group__interpolation__grp.html#ga1e31a6d4b982eee16bab9ae66c0ee042" title="Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y"...">leastSquareLinearFit</a> </dd></dl> </div> </div> <a class="anchor" id="ga1e31a6d4b982eee16bab9ae66c0ee042"></a><!-- doxytag: member="mrpt::math::leastSquareLinearFit" ref="ga1e31a6d4b982eee16bab9ae66c0ee042" args="(const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename NUMTYPE , class VECTORLIKE > </div> <table class="memname"> <tr> <td class="memname">NUMTYPE mrpt::math::leastSquareLinearFit </td> <td>(</td> <td class="paramtype">const NUMTYPE </td> <td class="paramname"><em>t</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const VECTORLIKE & </td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const VECTORLIKE & </td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>wrap2pi</em> = <code>false</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a single point "t". </p> <p>The vectors x and y must have size >=2, and all values of "x" must be different. If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range). </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__interpolation__grp.html#gadab1f3df3e592268d89214b345f7f816" title="Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the tw...">spline</a> </dd> <dd> <a class="el" href="group__geometry__grp.html#ga7c40628072431c08a126bef3bb2b9a27" title="Using eigenvalues, gets the best fitting line for a set of 2D points.">getRegressionLine</a>, <a class="el" href="group__geometry__grp.html#ga14d21b4e5b6277e7c0ea4f00b2eb2b3e" title="Using eigenvalues, gets the best fitting plane for a set of 3D points.">getRegressionPlane</a> </dd></dl> <p>Definition at line <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html#l01084">1084</a> of file <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html">base/include/mrpt/math/utils.h</a>.</p> <p>References <a class="el" href="mrpt__macros_8h_source.html#l00370">MRPT_START</a>, <a class="el" href="mrpt__macros_8h_source.html#l00282">ASSERT_</a>, <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html#l00188">mrpt::math::wrapToPi()</a>, and <a class="el" href="mrpt__macros_8h_source.html#l00374">MRPT_END</a>.</p> </div> </div> <a class="anchor" id="ga4939a6f537e90519df7149c550ed71c8"></a><!-- doxytag: member="mrpt::math::leastSquareLinearFit" ref="ga4939a6f537e90519df7149c550ed71c8" args="(const VECTORLIKE1 &ts, VECTORLIKE2 &outs, const VECTORLIKE3 &x, const VECTORLIKE3 &y, bool wrap2pi=false)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class VECTORLIKE1 , class VECTORLIKE2 , class VECTORLIKE3 > </div> <table class="memname"> <tr> <td class="memname">void mrpt::math::leastSquareLinearFit </td> <td>(</td> <td class="paramtype">const VECTORLIKE1 & </td> <td class="paramname"><em>ts</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">VECTORLIKE2 & </td> <td class="paramname"><em>outs</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const VECTORLIKE3 & </td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const VECTORLIKE3 & </td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>wrap2pi</em> = <code>false</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a sequence of points "ts" and returned at "outs". </p> <p>If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range). </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__interpolation__grp.html#gadab1f3df3e592268d89214b345f7f816" title="Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the tw...">spline</a>, <a class="el" href="group__geometry__grp.html#ga7c40628072431c08a126bef3bb2b9a27" title="Using eigenvalues, gets the best fitting line for a set of 2D points.">getRegressionLine</a>, <a class="el" href="group__geometry__grp.html#ga14d21b4e5b6277e7c0ea4f00b2eb2b3e" title="Using eigenvalues, gets the best fitting plane for a set of 3D points.">getRegressionPlane</a> </dd></dl> <p>Definition at line <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html#l01134">1134</a> of file <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html">base/include/mrpt/math/utils.h</a>.</p> <p>References <a class="el" href="mrpt__macros_8h_source.html#l00370">MRPT_START</a>, <a class="el" href="mrpt__macros_8h_source.html#l00282">ASSERT_</a>, <a class="el" href="base_2include_2mrpt_2math_2utils_8h_source.html#l00188">mrpt::math::wrapToPi()</a>, and <a class="el" href="mrpt__macros_8h_source.html#l00374">MRPT_END</a>.</p> </div> </div> <a class="anchor" id="gadab1f3df3e592268d89214b345f7f816"></a><!-- doxytag: member="mrpt::math::spline" ref="gadab1f3df3e592268d89214b345f7f816" args="(const double t, const vector_double &x, const vector_double &y, bool wrap2pi=false)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">double BASE_IMPEXP mrpt::math::spline </td> <td>(</td> <td class="paramtype">const double </td> <td class="paramname"><em>t</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const vector_double & </td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const vector_double & </td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>wrap2pi</em> = <code>false</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the two middle points If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range). </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__interpolation__grp.html#ga1e31a6d4b982eee16bab9ae66c0ee042" title="Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y"...">leastSquareLinearFit</a> </dd></dl> </div> </div> </div> <br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150"> </td></tr> </table> </body></html>