File: Interpolation-on-Scattered-Data.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (151 lines) | stat: -rw-r--r-- 8,452 bytes parent folder | download
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Interpolation on Scattered Data (GNU Octave (version 6.2.0))</title>

<meta name="description" content="Interpolation on Scattered Data (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Interpolation on Scattered Data (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Geometry.html" rel="up" title="Geometry">
<link href="Vector-Rotation-Matrices.html" rel="next" title="Vector Rotation Matrices">
<link href="Convex-Hull.html" rel="prev" title="Convex Hull">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<span id="Interpolation-on-Scattered-Data"></span><div class="header">
<p>
Next: <a href="Vector-Rotation-Matrices.html" accesskey="n" rel="next">Vector Rotation Matrices</a>, Previous: <a href="Convex-Hull.html" accesskey="p" rel="prev">Convex Hull</a>, Up: <a href="Geometry.html" accesskey="u" rel="up">Geometry</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Interpolation-on-Scattered-Data-1"></span><h3 class="section">30.4 Interpolation on Scattered Data</h3>

<p>An important use of the Delaunay tessellation is that it can be used to
interpolate from scattered data to an arbitrary set of points.  To do
this the N-simplex of the known set of points is calculated with
<code>delaunay</code> or <code>delaunayn</code>.  Then the simplices in to which the
desired points are found are identified.  Finally the vertices of the simplices
are used to interpolate to the desired points.  The functions that perform this
interpolation are <code>griddata</code>, <code>griddata3</code> and <code>griddatan</code>.
</p>
<span id="XREFgriddata"></span><dl>
<dt id="index-griddata">: <em><var>zi</var> =</em> <strong>griddata</strong> <em>(<var>x</var>, <var>y</var>, <var>z</var>, <var>xi</var>, <var>yi</var>)</em></dt>
<dt id="index-griddata-1">: <em><var>zi</var> =</em> <strong>griddata</strong> <em>(<var>x</var>, <var>y</var>, <var>z</var>, <var>xi</var>, <var>yi</var>, <var>method</var>)</em></dt>
<dt id="index-griddata-2">: <em>[<var>xi</var>, <var>yi</var>, <var>zi</var>] =</em> <strong>griddata</strong> <em>(&hellip;)</em></dt>
<dd>
<p>Generate a regular mesh from irregular data using interpolation.
</p>
<p>The function is defined by <code><var>z</var> = f (<var>x</var>, <var>y</var>)</code>.  Inputs
<code><var>x</var>, <var>y</var>, <var>z</var></code> are vectors of the same length or
<code><var>x</var>, <var>y</var></code> are vectors and <code><var>z</var></code> is matrix.
</p>
<p>The interpolation points are all <code>(<var>xi</var>, <var>yi</var>)</code>.  If <var>xi</var>,
<var>yi</var> are vectors then they are made into a 2-D mesh.
</p>
<p>The interpolation method can be <code>&quot;nearest&quot;</code>, <code>&quot;cubic&quot;</code> or
<code>&quot;linear&quot;</code>.  If method is omitted it defaults to <code>&quot;linear&quot;</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFgriddata3">griddata3</a>, <a href="#XREFgriddatan">griddatan</a>, <a href="Delaunay-Triangulation.html#XREFdelaunay">delaunay</a>.
</p></dd></dl>


<span id="XREFgriddata3"></span><dl>
<dt id="index-griddata3">: <em><var>vi</var> =</em> <strong>griddata3</strong> <em>(<var>x</var>, <var>y</var>, <var>z</var>, <var>v</var>, <var>xi</var>, <var>yi</var>, <var>zi</var>)</em></dt>
<dt id="index-griddata3-1">: <em><var>vi</var> =</em> <strong>griddata3</strong> <em>(<var>x</var>, <var>y</var>, <var>z</var>, <var>v</var>, <var>xi</var>, <var>yi</var>, <var>zi</var>, <var>method</var>)</em></dt>
<dt id="index-griddata3-2">: <em><var>vi</var> =</em> <strong>griddata3</strong> <em>(<var>x</var>, <var>y</var>, <var>z</var>, <var>v</var>, <var>xi</var>, <var>yi</var>, <var>zi</var>, <var>method</var>, <var>options</var>)</em></dt>
<dd>
<p>Generate a regular mesh from irregular data using interpolation.
</p>
<p>The function is defined by <code><var>v</var> = f (<var>x</var>, <var>y</var>, <var>z</var>)</code>.
The interpolation points are specified by <var>xi</var>, <var>yi</var>, <var>zi</var>.
</p>
<p>The interpolation method can be <code>&quot;nearest&quot;</code> or <code>&quot;linear&quot;</code>.
If method is omitted it defaults to <code>&quot;linear&quot;</code>.
</p>
<p>The optional argument <var>options</var> is passed directly to Qhull when
computing the Delaunay triangulation used for interpolation.  See
<code>delaunayn</code> for information on the defaults and how to pass different
values.
</p>
<p><strong>See also:</strong> <a href="#XREFgriddata">griddata</a>, <a href="#XREFgriddatan">griddatan</a>, <a href="Delaunay-Triangulation.html#XREFdelaunayn">delaunayn</a>.
</p></dd></dl>


<span id="XREFgriddatan"></span><dl>
<dt id="index-griddatan">: <em><var>yi</var> =</em> <strong>griddatan</strong> <em>(<var>x</var>, <var>y</var>, <var>xi</var>)</em></dt>
<dt id="index-griddatan-1">: <em><var>yi</var> =</em> <strong>griddatan</strong> <em>(<var>x</var>, <var>y</var>, <var>xi</var>, <var>method</var>)</em></dt>
<dt id="index-griddatan-2">: <em><var>yi</var> =</em> <strong>griddatan</strong> <em>(<var>x</var>, <var>y</var>, <var>xi</var>, <var>method</var>, <var>options</var>)</em></dt>
<dd>
<p>Generate a regular mesh from irregular data using interpolation.
</p>
<p>The function is defined by <code><var>y</var> = f (<var>x</var>)</code>.
The interpolation points are all <var>xi</var>.
</p>
<p>The interpolation method can be <code>&quot;nearest&quot;</code> or <code>&quot;linear&quot;</code>.
If method is omitted it defaults to <code>&quot;linear&quot;</code>.
</p>
<p>The optional argument <var>options</var> is passed directly to Qhull when
computing the Delaunay triangulation used for interpolation.  See
<code>delaunayn</code> for information on the defaults and how to pass different
values.
</p>
<p><strong>See also:</strong> <a href="#XREFgriddata">griddata</a>, <a href="#XREFgriddata3">griddata3</a>, <a href="Delaunay-Triangulation.html#XREFdelaunayn">delaunayn</a>.
</p></dd></dl>


<p>An example of the use of the <code>griddata</code> function is
</p>
<div class="example">
<pre class="example">rand (&quot;state&quot;, 1);
x = 2*rand (1000,1) - 1;
y = 2*rand (size (x)) - 1;
z = sin (2*(x.^2+y.^2));
[xx,yy] = meshgrid (linspace (-1,1,32));
zz = griddata (x, y, z, xx, yy);
mesh (xx, yy, zz);
</pre></div>

<p>that interpolates from a random scattering of points, to a uniform grid.
The output of the above can be seen in <a href="#fig_003agriddata">Figure 30.6</a>.
</p>
<div class="float"><span id="fig_003agriddata"></span>
<div align="center"><img src="griddata.png" alt="griddata">
</div>
<div class="float-caption"><p><strong>Figure 30.6: </strong>Interpolation from a scattered data to a regular grid</p></div></div>
<hr>
<div class="header">
<p>
Next: <a href="Vector-Rotation-Matrices.html" accesskey="n" rel="next">Vector Rotation Matrices</a>, Previous: <a href="Convex-Hull.html" accesskey="p" rel="prev">Convex Hull</a>, Up: <a href="Geometry.html" accesskey="u" rel="up">Geometry</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>