%% Example 4.23 Trend and detail decomposition for CDF(2,2)
% The trend component of \delta_0 for the CDF(2,2) transform is \frac{\left(-\delta_{-3} -2\delta_{-2} +5\delta_{-1} +12\delta_0 +5\delta_1 -2\delta_2 -\delta_3 \right)}{16} . Here's the plot.
%

trend = [0 -1 -2 5 12 5 -2 -1 0]/16;
plot(trend)
title('Trend for CDF(2,2) decomposition of \delta_0')
axis([1 9 -0.2 0.8])
xticks([1 3 5 7 9])
xticklabels({'-4','-2','0','2','4'})
yticks([0 0.2 0.4 0.6])

%
% The detail component is \frac{\left(\delta_{-3} +2\delta_{-2} -5\delta_{-1} +4\delta_0 -5\delta_1 +2\delta_2 +\delta_3 \right)}{16} . Here's the plot.
%

detail = [0 1 2 -5 4 -5 2 1 0]/16;
plot(detail)
title('Detail for CDF(2,2) decomposition of \delta_0')
axis([1 9 -0.4 0.4])
xticks([1 3 5 7 9])
xticklabels({'-4','-2','0','2','4'})
yticks([-0.2 0 0.2])