% 2-D haar DWT
clear
x=[1 2 3 1;
   2 1 3 4;
   2 2 1 -2;
   4 1 2 3] % input
[c,l] = wavedec2(x,1,'haar'); % output 1 stage
a=appcoef2(c,l,'haar');a % coefficients
[v,h,d]=detcoef2('all',c,l,1);
h % coefficients
v % coefficients
d % coefficients
xr = waverec2(c,l,'haar') % reconstructed data




