clear %  interpolation 
x=[2 1 4 2;
   3 1 2 1;
   1 2 1 4; 
   4 1 2 3] % input
N=size(x,1);
%
[xi,yi] = meshgrid(1:0.5:N,1:0.5:N);
[a,b] = meshgrid(1:0.25:N,1:0.25:N);
y1 = interp2(x,xi,yi,'nearest') % nearest, increment 0.5
y2 = interp2(x,xi,yi) % bilinear, increment 0.5
y3 = interp2(x,a,b) % bilinear, increment 0.25
 



