www.gusucode.com > wavelet 源码程序 matlab案例代码 > wavelet/InverseHaarTransformOfIntegerDataExample.m

    %% Inverse Haar Transform of Integer Data
% Obtain the Haar and inverse Haar transforms on a series of 
% random integers.
%%
% Create the series.
x = randi(10,100,1);
%%
% Obtain the Haar and inverse Haar transforms.
[a,d] = haart(x,'integer');
xrec = ihaart(a,d,'integer');
%%
% Plot and compare the original and reconstructed data.
subplot(2,1,1)
stem(x); title('Original Data');
subplot(2,1,2);
stem(xrec);
title('Reconstructed Integer-to-Integer Data');
%%
% Determine the maximum difference between the original data values and
% reconstructed values.  The difference is zero, which indicates
% perfect reconstruction.
max(abs(x(:)-xrec(:)))