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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
<?xml version="1.0" encoding="UTF-8"?>
<refentry version="5.0-subset Scilab" xml:id="interp2d" xml:lang="en"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:ns5="http://www.w3.org/1999/xhtml"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:db="http://docbook.org/ns/docbook">
<info>
<pubdate>$LastChangedDate$</pubdate>
</info>
<refnamediv>
<refname>interp2d</refname>
<refpurpose>bicubic spline (2d) evaluation function</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Calling Sequence</title>
<synopsis>[zp[,dzpdx,dzpdy[,d2zpdxx,d2zpdxy,d2zpdyy]]]=interp2d(xp,yp,x,y,C [,out_mode])</synopsis>
</refsynopsisdiv>
<refsection>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term>xp, yp</term>
<listitem>
<para>real vectors or matrices of same size</para>
</listitem>
</varlistentry>
<varlistentry>
<term>x,y,C</term>
<listitem>
<para>real vectors defining a bicubic spline or sub-spline function
(called <literal>s</literal> in the following)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>out_mode</term>
<listitem>
<para>(optional) string defining the evaluation of
<literal>s</literal> outside [x(1),x(nx)]x[y(1),y(ny)]</para>
</listitem>
</varlistentry>
<varlistentry>
<term>zp</term>
<listitem>
<para>vector or matrix of same format than <literal>xp</literal> and
<literal>yp</literal>, elementwise evaluation of
<literal>s</literal> on these points.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>dzpdx, dzpdy</term>
<listitem>
<para>vectors (or matrices) of same format than
<literal>xp</literal> and <literal>yp</literal>, elementwise
evaluation of the first derivatives of <literal>s</literal> on these
points.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>d2zpdxx, d2zpdxy, d2zpdyy</term>
<listitem>
<para>vectors (or matrices) of same format than
<literal>xp</literal> and <literal>yp</literal>, elementwise
evaluation of the second derivatives of <literal>s</literal> on
these points.</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Description</title>
<para>Given three vectors <literal>(x,y,C)</literal> defining a bicubic
spline or sub-spline function (see <link linkend="splin2d">splin2d</link>)
this function evaluates <emphasis>s</emphasis> (and <emphasis>ds/dx,
ds/dy, d2s/dxx, d2s/dxy, d2s/dyy</emphasis> if needed) at
<emphasis>(xp(i),yp(i))</emphasis> :</para>
<informalequation>
<mediaobject>
<imageobject>
<imagedata fileref="../mml/interp2_equation_1.mml" />
</imageobject>
</mediaobject>
</informalequation>
<para>The <literal>out_mode</literal> parameter defines the evaluation
rule for extrapolation, i.e. for <emphasis>(xp(i),yp(i)) not in
[x(1),x(nx)]x[y(1),y(ny)]</emphasis>:</para>
<variablelist>
<varlistentry>
<term>"by_zero"</term>
<listitem>
<para>an extrapolation by zero is done</para>
</listitem>
</varlistentry>
<varlistentry>
<term>"by_nan"</term>
<listitem>
<para>extrapolation by Nan</para>
</listitem>
</varlistentry>
<varlistentry>
<term>"C0"</term>
<listitem>
<para>the extrapolation is defined as follows :</para>
<programlisting role = ""><![CDATA[
s(x,y) = s(proj(x,y)) where proj(x,y) is nearest point
of [x(1),x(nx)]x[y(1),y(ny)] from (x,y)
]]></programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>"natural"</term>
<listitem>
<para>the extrapolation is done by using the nearest bicubic-patch
from (x,y).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>"periodic"</term>
<listitem>
<para> <literal>s</literal> is extended by periodicity.</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
// see the examples of splin2d
// this example shows some different extrapolation features
// interpolation of cos(x)cos(y)
n = 7; // a n x n interpolation grid
x = linspace(0,2*%pi,n); y = x;
z = cos(x')*cos(y);
C = splin2d(x, y, z, "periodic");
// now evaluate on a bigger domain than [0,2pi]x [0,2pi]
m = 80; // discretisation parameter of the evaluation grid
xx = linspace(-0.5*%pi,2.5*%pi,m); yy = xx;
[XX,YY] = ndgrid(xx,yy);
zz1 = interp2d(XX,YY, x, y, C, "C0");
zz2 = interp2d(XX,YY, x, y, C, "by_zero");
zz3 = interp2d(XX,YY, x, y, C, "periodic");
zz4 = interp2d(XX,YY, x, y, C, "natural");
clf()
subplot(2,2,1)
plot3d(xx, yy, zz1, flag=[2 6 4])
xtitle("extrapolation with the C0 outmode")
subplot(2,2,2)
plot3d(xx, yy, zz2, flag=[2 6 4])
xtitle("extrapolation with the by_zero outmode")
subplot(2,2,3)
plot3d(xx, yy, zz3, flag=[2 6 4])
xtitle("extrapolation with the periodic outmode")
subplot(2,2,4)
plot3d(xx, yy, zz4, flag=[2 6 4])
xtitle("extrapolation with the natural outmode")
xselect()
]]></programlisting>
</refsection>
<refsection>
<title>See Also</title>
<simplelist type="inline">
<member><link linkend="splin2d">splin2d</link></member>
</simplelist>
</refsection>
<refsection>
<title>Authors</title>
<para>B. Pincon</para>
</refsection>
</refentry>
|