1% Testing 1D linear interpolation. 2 3[xi] = linspace(0,1,30); 4fi = sin( xi*6 ); 5 6no = 20; 7x = rand(no,1); 8 9mask = ones(size(xi)); 10 11[H,out] = interp_regular(mask,{xi},{x}); 12 13f1 = interp1(xi,fi,x); 14 15f2 = H * fi(:); 16Difference = max(abs(f1(:) - f2(:))); 17 18if (Difference > 1e-6) 19 error('unexpected large difference with reference field'); 20end 21 22fprintf('(max difference=%g) ',Difference); 23 24% Copyright (C) 2014 Alexander Barth <a.barth@ulg.ac.be> 25% 26% This program is free software; you can redistribute it and/or modify it under 27% the terms of the GNU General Public License as published by the Free Software 28% Foundation; either version 2 of the License, or (at your option) any later 29% version. 30% 31% This program is distributed in the hope that it will be useful, but WITHOUT 32% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 34% details. 35% 36% You should have received a copy of the GNU General Public License along with 37% this program; if not, see <http://www.gnu.org/licenses/>. 38