You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
335 lines
18 KiB
HTML
335 lines
18 KiB
HTML
<!-- HTML header for doxygen 1.9.2-->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>CMSIS-DSP: Cubic Spline Interpolation</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<script type="text/javascript" src="footer.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function() { init_search(); });
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/x-mathjax-config">
|
|
MathJax.Hub.Config({
|
|
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
|
jax: ["input/TeX","output/HTML-CSS"],
|
|
});
|
|
</script>
|
|
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
|
|
<link href="$extra_stylesheet" rel="stylesheet" type="text/css" />
|
|
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
|
|
<link href="version.css" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript" src="../version.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 55px;">
|
|
<td id="projectlogo" style="padding: 1.5em;"><img alt="Logo" src="cmsis_logo_white_small.png"/></td>
|
|
<td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
|
|
<div id="projectname">CMSIS-DSP
|
|
 <span id="projectnumber"><script type="text/javascript">
|
|
<!--
|
|
writeHeader.call(this);
|
|
writeVersionDropdown(this);
|
|
//-->
|
|
</script>
|
|
</span>
|
|
</div>
|
|
<div id="projectbrief">CMSIS DSP Software Library</div>
|
|
</td>
|
|
<!--END !PROJECT_NAME-->
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.2 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
|
|
/* @license-end */
|
|
</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>Usage and Description</span></a></li>
|
|
<li class="current"><a href="modules.html"><span> API Reference</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.svg"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function(){initNavTree('group__SplineInterpolate.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle"><div class="title">Cubic Spline Interpolation<div class="ingroups"><a class="el" href="group__groupInterpolation.html">Interpolation Functions</a></div></div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:ga4ef053a783b251b085454b28f8aecb94"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__SplineInterpolate.html#ga4ef053a783b251b085454b28f8aecb94">arm_spline_f32</a> (<a class="el" href="structarm__spline__instance__f32.html">arm_spline_instance_f32</a> *S, const <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *xq, <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *pDst, uint32_t <a class="el" href="arm__variance__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>)</td></tr>
|
|
<tr class="memdesc:ga4ef053a783b251b085454b28f8aecb94"><td class="mdescLeft"> </td><td class="mdescRight">Processing function for the floating-point cubic spline interpolation. <a href="group__SplineInterpolate.html#ga4ef053a783b251b085454b28f8aecb94">More...</a><br /></td></tr>
|
|
<tr class="separator:ga4ef053a783b251b085454b28f8aecb94"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga5370a3c4a213e15bf57726406ec52ae0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__SplineInterpolate.html#ga5370a3c4a213e15bf57726406ec52ae0">arm_spline_init_f32</a> (<a class="el" href="structarm__spline__instance__f32.html">arm_spline_instance_f32</a> *S, <a class="el" href="interpolation__functions_8h.html#a545cad4aaf64955a2d2e93d7e806bcd7">arm_spline_type</a> type, const <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *x, const <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *y, uint32_t n, <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *coeffs, <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> *tempBuffer)</td></tr>
|
|
<tr class="memdesc:ga5370a3c4a213e15bf57726406ec52ae0"><td class="mdescLeft"> </td><td class="mdescRight">Initialization function for the floating-point cubic spline interpolation. <a href="group__SplineInterpolate.html#ga5370a3c4a213e15bf57726406ec52ae0">More...</a><br /></td></tr>
|
|
<tr class="separator:ga5370a3c4a213e15bf57726406ec52ae0"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
|
|
<p >Spline interpolation is a method of interpolation where the interpolant is a piecewise-defined polynomial called "spline".</p>
|
|
<dl class="section user"><dt>Introduction</dt><dd></dd></dl>
|
|
<p>Given a function f defined on the interval [a,b], a set of n nodes x(i) where a=x(1)<x(2)<...<x(n)=b and a set of n values y(i) = f(x(i)), a cubic spline interpolant S(x) is defined as:</p>
|
|
<pre>
|
|
S1(x) x(1) < x < x(2)
|
|
S(x) = ...
|
|
Sn-1(x) x(n-1) < x < x(n)
|
|
</pre><p >where</p>
|
|
<pre>
|
|
Si(x) = a_i+b_i(x-xi)+c_i(x-xi)^2+d_i(x-xi)^3 i=1, ..., n-1
|
|
</pre><dl class="section user"><dt>Algorithm</dt><dd></dd></dl>
|
|
<p>Having defined h(i) = x(i+1) - x(i)</p>
|
|
<pre>
|
|
h(i-1)c(i-1)+2[h(i-1)+h(i)]c(i)+h(i)c(i+1) = 3/h(i)*[a(i+1)-a(i)]-3/h(i-1)*[a(i)-a(i-1)] i=2, ..., n-1
|
|
</pre><p >It is possible to write the previous conditions in matrix form (Ax=B). In order to solve the system two boundary conidtions are needed.</p><ul>
|
|
<li>Natural spline: S1''(x1)=2*c(1)=0 ; Sn''(xn)=2*c(n)=0 In matrix form:</li>
|
|
</ul>
|
|
<pre>
|
|
| 1 0 0 ... 0 0 0 || c(1) | | 0 |
|
|
| h(0) 2[h(0)+h(1)] h(1) ... 0 0 0 || c(2) | | 3/h(2)*[a(3)-a(2)]-3/h(1)*[a(2)-a(1)] |
|
|
| ... ... ... ... ... ... ... || ... |=| ... |
|
|
| 0 0 0 ... h(n-2) 2[h(n-2)+h(n-1)] h(n-1) || c(n-1) | | 3/h(n-1)*[a(n)-a(n-1)]-3/h(n-2)*[a(n-1)-a(n-2)] |
|
|
| 0 0 0 ... 0 0 1 || c(n) | | 0 |
|
|
</pre><ul>
|
|
<li>Parabolic runout spline: S1''(x1)=2*c(1)=S2''(x2)=2*c(2) ; Sn-1''(xn-1)=2*c(n-1)=Sn''(xn)=2*c(n) In matrix form:</li>
|
|
</ul>
|
|
<pre>
|
|
| 1 -1 0 ... 0 0 0 || c(1) | | 0 |
|
|
| h(0) 2[h(0)+h(1)] h(1) ... 0 0 0 || c(2) | | 3/h(2)*[a(3)-a(2)]-3/h(1)*[a(2)-a(1)] |
|
|
| ... ... ... ... ... ... ... || ... |=| ... |
|
|
| 0 0 0 ... h(n-2) 2[h(n-2)+h(n-1)] h(n-1) || c(n-1) | | 3/h(n-1)*[a(n)-a(n-1)]-3/h(n-2)*[a(n-1)-a(n-2)] |
|
|
| 0 0 0 ... 0 -1 1 || c(n) | | 0 |
|
|
</pre><p >A is a tridiagonal matrix (a band matrix of bandwidth 3) of size N=n+1. The factorization algorithms (A=LU) can be simplified considerably because a large number of zeros appear in regular patterns. The Crout method has been used: 1) Solve LZ=B</p>
|
|
<pre>
|
|
u(1,2) = A(1,2)/A(1,1)
|
|
z(1) = B(1)/l(11)
|
|
|
|
FOR i=2, ..., N-1
|
|
l(i,i) = A(i,i)-A(i,i-1)u(i-1,i)
|
|
u(i,i+1) = a(i,i+1)/l(i,i)
|
|
z(i) = [B(i)-A(i,i-1)z(i-1)]/l(i,i)
|
|
|
|
l(N,N) = A(N,N)-A(N,N-1)u(N-1,N)
|
|
z(N) = [B(N)-A(N,N-1)z(N-1)]/l(N,N)
|
|
</pre><p >2) Solve UX=Z</p>
|
|
<pre>
|
|
c(N)=z(N)
|
|
|
|
FOR i=N-1, ..., 1
|
|
c(i)=z(i)-u(i,i+1)c(i+1)
|
|
</pre><p >c(i) for i=1, ..., n-1 are needed to compute the n-1 polynomials. b(i) and d(i) are computed as:</p><ul>
|
|
<li>b(i) = [y(i+1)-y(i)]/h(i)-h(i)*[c(i+1)+2*c(i)]/3</li>
|
|
<li>d(i) = [c(i+1)-c(i)]/[3*h(i)] Moreover, a(i)=y(i).</li>
|
|
</ul>
|
|
<dl class="section user"><dt>Behaviour outside the given intervals</dt><dd></dd></dl>
|
|
<p>It is possible to compute the interpolated vector for x values outside the input range (xq<x(1); xq>x(n)). The coefficients used to compute the y values for xq<x(1) are going to be the ones used for the first interval, while for xq>x(n) the coefficients used for the last interval.</p>
|
|
<dl class="section user"><dt>Initialization function</dt><dd></dd></dl>
|
|
<p>The initialization function takes as input two arrays that the user has to allocate: <code>coeffs</code> will contain the b, c, and d coefficients for the (n-1) intervals (n is the number of known points), hence its size must be 3*(n-1); <code>tempBuffer</code> is temporally used for internal computations and its size is n+n-1.</p>
|
|
<dl class="section user"><dt></dt><dd></dd></dl>
|
|
<p>The x input array must be strictly sorted in ascending order and it must not contain twice the same value (x(i)<x(i+1)). </p>
|
|
<h2 class="groupheader">Function Documentation</h2>
|
|
<a id="ga4ef053a783b251b085454b28f8aecb94" name="ga4ef053a783b251b085454b28f8aecb94"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ga4ef053a783b251b085454b28f8aecb94">◆ </a></span>arm_spline_f32()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void arm_spline_f32 </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="structarm__spline__instance__f32.html">arm_spline_instance_f32</a> * </td>
|
|
<td class="paramname"><em>S</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> * </td>
|
|
<td class="paramname"><em>xq</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> * </td>
|
|
<td class="paramname"><em>pDst</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>blockSize</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">S</td><td>points to an instance of the floating-point spline structure. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">xq</td><td>points to the x values of the interpolated data points. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">pDst</td><td>points to the block of output data. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">blockSize</td><td>number of samples of output data. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ga5370a3c4a213e15bf57726406ec52ae0" name="ga5370a3c4a213e15bf57726406ec52ae0"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ga5370a3c4a213e15bf57726406ec52ae0">◆ </a></span>arm_spline_init_f32()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void arm_spline_init_f32 </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="structarm__spline__instance__f32.html">arm_spline_instance_f32</a> * </td>
|
|
<td class="paramname"><em>S</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="interpolation__functions_8h.html#a545cad4aaf64955a2d2e93d7e806bcd7">arm_spline_type</a> </td>
|
|
<td class="paramname"><em>type</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> * </td>
|
|
<td class="paramname"><em>x</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const <a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> * </td>
|
|
<td class="paramname"><em>y</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>n</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> * </td>
|
|
<td class="paramname"><em>coeffs</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715">float32_t</a> * </td>
|
|
<td class="paramname"><em>tempBuffer</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in,out]</td><td class="paramname">S</td><td>points to an instance of the floating-point spline structure. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">type</td><td>type of cubic spline interpolation (boundary conditions) </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">x</td><td>points to the x values of the known data points. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">y</td><td>points to the y values of the known data points. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>number of known data points. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">coeffs</td><td>coefficients array for b, c, and d </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">tempBuffer</td><td>buffer array for internal computations </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">
|
|
<script type="text/javascript">
|
|
<!--
|
|
writeFooter.call(this);
|
|
//-->
|
|
</script>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|