summaryrefslogtreecommitdiff
path: root/modules/interpolation/help/en_US/cshep2d.xml
blob: 03641aecc66afa406259717bab60aec21e742042 (plain)
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
<?xml version="1.0" encoding="UTF-8"?>
<refentry 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" xmlns:scilab="http://www.scilab.org" xml:id="cshep2d" xml:lang="en">
    <refnamediv>
        <refname>cshep2d</refname>
        <refpurpose>bidimensional cubic shepard (scattered)
            interpolation
        </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Calling Sequence</title>
        <synopsis>tl_coef = cshep2d(xyz)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>xyz</term>
                <listitem>
                    <para>a n x 3 matrix of the (no gridded) interpolation points (the i
                        th row given the (x,y) coordinates then the altitude z of the i th
                        interpolation point)
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>tl_coef</term>
                <listitem>
                    <para>a tlist scilab structure (of type cshep2d)</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>This function is useful to define a 2d interpolation function when
            the interpolation points are not on a grid (you may use it in this case
            but <link linkend="splin2d">splin2d</link> is better for that purpose).
            The interpolant is a cubic shepard one and is a C2 (twice continuously
            differentiable) bivariate function <emphasis>s(x,y)</emphasis> such that :
            <emphasis>s(xi,yi)=zi</emphasis> for all <emphasis>i=1,..,n</emphasis>
            (<emphasis>(xi,yi,zi)</emphasis> being the i th row of
            <literal>xyz</literal>).
        </para>
        <para>
            The evaluation of <emphasis>s</emphasis> at some points must be done
            by the <link linkend="eval_cshep2d">eval_cshep2d</link> function.
        </para>
    </refsection>
    <refsection>
        <title>Remark</title>
        <para>
            The function works if <emphasis role="bold">n&gt;= 10</emphasis>,
            if the nodes are not all colinears (i.e. the <emphasis>(x,y)</emphasis>
            coordinates of the interpolation points are not on the same straight
            line), and if there is no duplicate nodes (i.e. 2 or more interpolation
            points with the same <emphasis>(x,y)</emphasis> coordinates). An error is
            issued if these conditions are not respected.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[ 
// interpolation of cos(x)cos(y) with randomly chosen interpolation points
n = 150; // nb of interpolation points
xy = grand(n,2,"unf",0,2*%pi);
z = cos(xy(:,1)).*cos(xy(:,2));
xyz = [xy z];
tl_coef = cshep2d(xyz);

// evaluation on a grid
m = 30;
xx = linspace(0,2*%pi,m);
[X,Y] = ndgrid(xx,xx);
Z = eval_cshep2d(X,Y, tl_coef);
clf()
plot3d(xx,xx,Z,flag=[2 6 4])
param3d1(xy(:,1),xy(:,2),list(z,-9), flag=[0 0])
xtitle("Cubic Shepard Interpolation of cos(x)cos(y) with randomly chosen interpolation points")
legends("interpolation points",-9,1)
show_window()
 ]]></programlisting>
        <scilab:image>
            n = 150; // nb of interpolation points
            xy = grand(n,2,"unf",0,2*%pi);
            z = cos(xy(:,1)).*cos(xy(:,2));
            xyz = [xy z];
            tl_coef = cshep2d(xyz);
            
            // evaluation on a grid
            m = 30;
            xx = linspace(0,2*%pi,m);
            [X,Y] = ndgrid(xx,xx);
            Z = eval_cshep2d(X,Y, tl_coef);
            clf()
            plot3d(xx,xx,Z,flag=[2 6 4])
            param3d1(xy(:,1),xy(:,2),list(z,-9), flag=[0 0])
            xtitle("Cubic Shepard Interpolation of cos(x)cos(y) with randomly chosen interpolation points")
            legends("interpolation points",-9,1)
            show_window()
        </scilab:image>
    </refsection>
    <refsection role="see also">
        <title>See Also</title>
        <simplelist type="inline">
            <member>
                <link linkend="splin2d">splin2d</link>
            </member>
            <member>
                <link linkend="eval_cshep2d">eval_cshep2d</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.4.0</revnumber>
                <revremark>previously, imaginary part of input arguments were implicitly ignored.</revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>