/usr/share/doc/pyxplot/html/ex-interpolation.html is in pyxplot-doc 0.9.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Datafile interpolation</title>
<link href="sect0032.html" title="Two-dimensional interpolation" rel="next" />
<link href="sec-fit_command.html" title="Function fitting" rel="prev" />
<link href="ch-numerics.html" title="Working with data" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-fit_command.html" title="Function fitting"><img alt="Previous: Function fitting" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="ch-numerics.html" title="Working with data"><img alt="Up: Working with data" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0032.html" title="Two-dimensional interpolation"><img alt="Next: Two-dimensional interpolation" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>
</span><span>
<span>
<a href="ch-numerics.html">Working with data</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">Datafile interpolation</b>
</span>
</span>
<hr />
</div>
<div><h1 id="ex:interpolation">5.7 Datafile interpolation</h1>
<p> <a name="a0000000553" id="a0000000553"></a> </p><p>The <tt class="tt">interpolate</tt> command<a name="a0000000554" id="a0000000554"></a> can be used to generate a special function within Pyxplot’s mathematical environment which interpolates a set of data points supplied from a data file. As with other commands, data can also be supplied from functions, or from a colon-separated list of vectors (see Section <a href="sec-vectorplot.html">6.5.3</a>). Either one- or two-dimensional interpolation is possible. Two-dimensional interpolation is described in the next section. </p><p>In the case of one-dimensional interpolation, various different types of interpolation are supported: linear interpolation, power law interpolation, polynomial interpolation, cubic spline interpolation and akima spline interpolation. Stepwise interpolation returns the value of the datapoint nearest to the requested point in argument space. The use of polynomial interpolation with large datasets is strongly discouraged, as polynomial fits tend to show severe oscillations between data points. </p><p>Except in the case of stepwise interpolation, extrapolation is not permitted; if an attempt is made to evaluate an interpolated function beyond the limits of the data points which it interpolates, Pyxplot returns an error or value of not-a-number. This behaviour can be configured using the <tt class="tt">set numeric errors quiet</tt> command<a name="a0000000555" id="a0000000555"></a> (see Section <a href="sec-num_errs.html">4.4</a>). </p><p>The <tt class="tt">interpolate</tt> command<a name="a0000000556" id="a0000000556"></a> has similar syntax to the <tt class="tt">fit</tt> command<a name="a0000000557" id="a0000000557"></a>: </p><pre>
interpolate ( akima | linear | loglinear | polynomial |
spline | stepwise |
2d [( bmp_r | bmp_g | bmp_b )] )
[<range specification>] <function name>"()"
'<filename>'
[ every <expression> {:<expression} ]
[ index <value> ]
[ select <expression> ]
[ using <expression> {:<expression} ]
</pre><p>A very common application of the <tt class="tt">interpolate</tt> command<a name="a0000000558" id="a0000000558"></a> is to perform arithmetic functions such as addition or subtraction on datasets which are not sampled at the same abscissa values. The following example would plot the difference between two such datasets: </p><pre>
interpolate linear f() 'data1.dat'
interpolate linear g() 'data2.dat'
plot [min:max] f(x)-g(x)
</pre><p>Note that it is advisable to supply a range to the <tt class="tt">plot</tt> command in this example: because the two datasets have been turned into continuous functions, the <tt class="tt">plot</tt> command has to guess a range over which to plot them, unless one is explicitly supplied. </p><p>The <tt class="tt">spline</tt> command<a name="a0000000559" id="a0000000559"></a> is an alias for <tt class="tt">interpolate spline</tt>; the following two statements are equivalent: </p><pre>
spline f() 'data1.dat'
interpolate spline f() 'data1.dat'
</pre><p> <span class="upshape"><span class="mdseries"><span class="rm">A demonstration of the <tt class="tt">linear</tt>, <tt class="tt">spline</tt> and <tt class="tt">akima</tt> modes of interpolation.</span></span></span></p><div>
<table cellspacing="0" class="tabular">
<tr>
<td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this example, we demonstrate the <tt class="tt">linear</tt>, <tt class="tt">spline</tt> and <tt class="tt">akima</tt> modes of interpolation using an example data file with non-smooth data generated using the <tt class="tt">tabulate</tt> command (see Section <a href="sec-tabulate.html">5.5</a>): </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">f(x) = 0</tt><br /><tt class="tt">f(x)[0:1] = 0.5</tt><br /><tt class="tt">f(x)[2:4] = cos((x-3)*pi/2)</tt><br /><tt class="tt">set samples 20</tt><br /><tt class="tt">tabulate [0:4] f(x)</tt> </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p>Having set three functions to interpolate these non-smooth data in different ways, we plot them with a vertical offset of <img src="images/img-0171.png" alt="$0.1$" style="vertical-align:0px;
width:22px;
height:12px" class="math gen" /> between them for clarity. The interpolated data fileis plotted with points three times to show where each of the interpolation functions is pinned. </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily">interpolate linear f_linear() "interpolation.dat"</tt><br /><tt class="ttfamily">interpolate spline f_spline() "interpolation.dat"</tt><br /><tt class="ttfamily">interpolate akima f_akima () "interpolation.dat"</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily">set key top left</tt><br /><tt class="ttfamily">plot [0:4][-0.1:1.3] <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> "interpolation.dat" using 1:($2+0.0) notitle with points pt 1, <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> f_linear(x)+0.0 title "Linear", <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> "interpolation.dat" using 1:($2+0.1) notitle with points pt 1, <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> f_spline(x)+0.1 title "Spline", <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> "interpolation.dat" using 1:($2+0.2) notitle with points pt 1, <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> f_akima (x)+0.2 title "Akima"</tt> </small> </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p>The resulting plot is shown below: </p></td>
</tr><tr>
<td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"><p><center>
<img src="images/img-0173.png" alt="\includegraphics[width=\textwidth ]{examples/eps/ex_interpolation}" style="width:" /></center> </p></td>
</tr>
</table>
</div></div>
<div class="contents section-contents"><!--<strong>Subsections</strong>-->
<ul>
<li><a href="sect0032.html">5.7.1 Two-dimensional interpolation</a>
</li>
</ul>
</div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-fit_command.html" title="Function fitting"><img alt="Previous: Function fitting" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="ch-numerics.html" title="Working with data"><img alt="Up: Working with data" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0032.html" title="Two-dimensional interpolation"><img alt="Next: Two-dimensional interpolation" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>
</body>
</html>
|