If you have R2016b and the Symbolic Math Toolbox installed, you can just use the piecewise function:because
An adaptive window around each pixel is used in ENO interpolation method to define a support window for the 2D piecewise reconstruction of point values that avoids high gradient regions whenever possible [45,46]. The reconstruction scheme selects an interpolating support window whose solution is the...