summaryrefslogtreecommitdiff
path: root/modules/interpolation/tests/unit_tests/interp.tst
blob: c3032949544de5ed7c345a1efa1232da9ff10b90 (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
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - DIGITEO - Allan CORNET
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================

x = linspace(0,1,11)';
y = cosh(x-0.5);
d = splin(x,y);
xx = linspace(-0.5,1.5,401)';
yy0 = interp(xx,x,y,d,"C0");
assert_checkequal(size(yy0), [401 1]);
assert_checkfalse(yy0 > 2);
assert_checkfalse(yy0 < 0);


yy1 = interp(xx,x,y,d,"linear");
assert_checkequal(size(yy1), [401 1]);
assert_checkfalse(yy1 > 2);
assert_checkfalse(yy1 < 0);


yy2 = interp(xx,x,y,d,"natural");
assert_checkequal(size(yy2), [401 1]);
assert_checkfalse(yy2 > 2);
assert_checkfalse(yy2 < 0);

yy3 = interp(xx,x,y,d,"periodic");
assert_checkequal(size(yy3), [401 1]);
assert_checkfalse(yy3 > 2);
assert_checkfalse(yy3 < 0);