Home > Matching_SYM_LSM > src > Functions > Splines > LSM_f_cubic_interpolation.m

LSM_f_cubic_interpolation

PURPOSE ^

spline interpolation

SYNOPSIS ^

function z=LSM_f_cubic_interpolation(x,y,f)

DESCRIPTION ^

 spline interpolation

 f   = N x M array of function values
 x,y = real coordinates \in [2:N-1,2:M-1]

 z   = interpolated value

 wf 08/2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function z=LSM_f_cubic_interpolation(x,y,f)
0002 % spline interpolation
0003 %
0004 % f   = N x M array of function values
0005 % x,y = real coordinates \in [2:N-1,2:M-1]
0006 %
0007 % z   = interpolated value
0008 %
0009 % wf 08/2012
0010 
0011 i=floor(x);
0012 j=floor(y);
0013 u=x-i;
0014 v=y-j;
0015 p=[1 u u^2 u^3]';
0016 q=[1 v v^2 v^3]';
0017 M= 1/2*[  0  2  0  0 ;
0018          -1  0  1  0;
0019           2 -5  4 -1;
0020          -1  3 -3  1];
0021 Fij = [f(i-1,j-1), f(i-1,j), f(i-1,j+1), f(i-1,j+2);...
0022        f(i  ,j-1), f(i  ,j), f(i  ,j+1), f(i  ,j+2);...
0023        f(i+1,j-1), f(i+1,j), f(i+1,j+1), f(i+1,j+2);...
0024        f(i+2,j-1), f(i+2,j), f(i+2,j+1), f(i+2,j+2);...
0025         ];   
0026 z=p'*M*Fij*M'*q;  
0027 end

Generated on Sun 19-Jul-2020 23:00:25 by m2html © 2005