%% Section 3.2 Example of Haar wavelet transform
% I look at the one-scale Haar wavelet transform of the level 3 signal

s3 = [56 40 8 24 48 48 40 16]

%

plot(s3)
xticks([1 2 3 4 5 6 7 8])
xticklabels({'0','1','2','3', '4','5','6','7'})
title('Level-three signal')

%
% The level 2 trend is

s2 =  [48 16 48 28]

%
% The level 2 detail is

d2 = [8 -8 0 12]

%

subplot(1,2,1)
plot(s2)
xticks([1 2 3 4])
xticklabels({'0','1','2','3'})
title('Level-two trend')
subplot(1,2,2)
plot(d2)
xticks([1 2 3 4])
xticklabels({'0','1','2','3'})
title('Level-two detail')