Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 322

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Interpolation on Scattered Data - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Geometry.html#Geometry" title="Geometry">
<link rel="prev" href="Convex-Hull.html#Convex-Hull" title="Convex Hull">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Interpolation-on-Scattered-Data"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Convex-Hull.html#Convex-Hull">Convex Hull</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Geometry.html#Geometry">Geometry</a>
<hr>
</div>

<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>, <code>delaunay3</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>.

<!-- griddata scripts/geometry/griddata.m -->
   <p><a name="doc_002dgriddata"></a>

<div class="defun">
&mdash; Function File: <var>zi</var> = <b>griddata</b> (<var>x, y, z, xi, yi, method</var>)<var><a name="index-griddata-2814"></a></var><br>
&mdash; Function File: [<var>xi</var>, <var>yi</var>, <var>zi</var>] = <b>griddata</b> (<var>x, y, z, xi, yi, method</var>)<var><a name="index-griddata-2815"></a></var><br>
<blockquote>
        <p>Generate a regular mesh from irregular data using interpolation. 
The function is defined by <var>z</var><code> = f (</code><var>x</var><code>, </code><var>y</var><code>)</code>. 
Inputs <var>x</var><code>, </code><var>y</var><code>, </code><var>z</var> are vectors of the same length
or <var>x</var><code>, </code><var>y</var> are vectors and <var>z</var> is matrix.

        <p>The interpolation points are all <code>(</code><var>xi</var><code>, </code><var>yi</var><code>)</code>.  If
<var>xi</var>, <var>yi</var> are vectors then they are made into a 2-D mesh.

        <p>The interpolation method can be <code>"nearest"</code>, <code>"cubic"</code> or
<code>"linear"</code>.  If method is omitted it defaults to <code>"linear"</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002ddelaunay.html#doc_002ddelaunay">delaunay</a>. 
</p></blockquote></div>

<!-- griddata3 scripts/geometry/griddata3.m -->
   <p><a name="doc_002dgriddata3"></a>

<div class="defun">
&mdash; Function File: <var>vi</var> = <b>griddata3</b> (<var>x, y, z, v, xi, yi, zi, method, options</var>)<var><a name="index-griddata3-2816"></a></var><br>
<blockquote>
        <p>Generate a regular mesh from irregular data using interpolation. 
The function is defined by <var>v</var><code> = f (</code><var>x</var><code>, </code><var>y</var><code>, </code><var>z</var><code>)</code>. 
The interpolation points are specified by <var>xi</var>, <var>yi</var>, <var>zi</var>.

        <p>The interpolation method can be <code>"nearest"</code> or <code>"linear"</code>. 
If method is omitted it defaults to <code>"linear"</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dgriddata.html#doc_002dgriddata">griddata</a>, <a href="doc_002dgriddatan.html#doc_002dgriddatan">griddatan</a>, <a href="doc_002ddelaunayn.html#doc_002ddelaunayn">delaunayn</a>. 
</p></blockquote></div>

<!-- griddatan scripts/geometry/griddatan.m -->
   <p><a name="doc_002dgriddatan"></a>

<div class="defun">
&mdash; Function File: <var>yi</var> = <b>griddatan</b> (<var>x, y, xi, method, options</var>)<var><a name="index-griddatan-2817"></a></var><br>
<blockquote>
        <p>Generate a regular mesh from irregular data using interpolation. 
The function is defined by <var>y</var><code> = f (</code><var>x</var><code>)</code>. 
The interpolation points are all <var>xi</var>.

        <p>The interpolation method can be <code>"nearest"</code> or <code>"linear"</code>. 
If method is omitted it defaults to <code>"linear"</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dgriddata.html#doc_002dgriddata">griddata</a>, <a href="doc_002ddelaunayn.html#doc_002ddelaunayn">delaunayn</a>. 
</p></blockquote></div>

   <p>An example of the use of the <code>griddata</code> function is

<pre class="example">     rand("state",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));
     griddata(x,y,z,xx,yy);
</pre>
   <p class="noindent">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.html#fig_003agriddata">fig:griddata</a>.

   <div class="float">
<a name="fig_003agriddata"></a><div align="center"><img src="griddata.png" alt="griddata.png"></div>
   <p><strong class="float-caption">Figure 30.6: Interpolation from a scattered data to a regular grid</strong></p></div>

<!-- DO NOT EDIT!  Generated automatically by munge-texi.pl. -->
<!-- Copyright (C) 1996-2012 John W. Eaton -->
<!-- This file is part of Octave. -->
<!-- Octave is free software; you can redistribute it and/or modify it -->
<!-- under the terms of the GNU General Public License as published by the -->
<!-- Free Software Foundation; either version 3 of the License, or (at -->
<!-- your option) any later version. -->
<!-- Octave is distributed in the hope that it will be useful, but WITHOUT -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -->
<!-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License -->
<!-- for more details. -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with Octave; see the file COPYING.  If not, see -->
<!-- <http://www.gnu.org/licenses/>. -->
   </body></html>