% affine transformation translation 
clear
x = [2 1 3 4;
    1 1 2 3;
    4 2 1 3;
    2 2 3 1] % input
w = [1 0 3; 0 1 2; 0 0 1] % shift
tform=maketform('affine',w');
out = imtransform(x',tform,'XData',...
    [1 size(x,2)+3],'YData',[1 size(x,1)+2])'










