Forums

Redundant Haar Wavelet

Started by acep...@gmail.com June 3, 2005
Hello Everybody, I'm trying to replicate in Matlab code the Redundant Haar
Wavelet, as from the

http://strule.cs.qub.ac.uk/~gzheng/financial-engineering/finpapermay99.html

Following this statement,

"The non-decimated Haar algorithm is exactly the same as the trous
algorithm, except that the low-pass filter h, (1/16,1/4,3/8,1/4,1/16), is
replaced by the simpler filter (1/2, 1/2). There h is now non-symmetric."

I wrote this code in Matlab

appa';
for j = 0:4
for i = 1:l
if (i-2^j)==0
X = [app(i) app(1)];
else
X = [app(i) app(abs((i-2^j)))];
end
C(i)=(0.5*X(1)+0.5*X(2));
end
w((j+1),(1:l))=app(1:end)-C(1:end);
app = C;
end
D1 = w(1,(1:l));
D2 = w(2,(1:l));
D3 = w(3,(1:l));
D4 = w(4,(1:l));
D5 = w(5,(1:l));
A5 = C;

figure;
hold on;
plot(A5);
plot(A5+D5,'r-');
plot(A5+D5+D4,'g-');
plot(A5+D5+D4+D3,'y-');
plot(A5+D5+D4+D3+D2,'c-');
plot(A5+D5+D4+D3+D2+D1,'m-');

but there must be something wrong because I get lag when overplot the
details, while there shouldn't be any lag.

The symmetric version of the Haar do not show lag but it's not suitable
for finance application because of the distorsion effect on borders.

Any help is very much appreciated, thanks a lot!

Albert

PS I'm involved in financial market forecast using scientifics methods,
anyone interested in can contact me for collaboration, acepsut@acep...


Hi Albert,

If you ignore the lag, does the result look ok?

Non-symmetric filters introduce phase shifts. The effect of a phase shift
is to displace events along the time axis; that is, if a maximum in the
original series occurs at time t0, the phase shifted maximum occurs at time
t0 + delta, where delta may be positive or negative.

So while the non-symmetric filter is important to detect edge boundaries in
this application, I think the delay is unavoidable. However, from the look
of this paper a lot of the results show the effects of de-noising the
signal? The (1/2, 1/2) filter coefficients are a simple averaging filter
that fit in with the de-noising hypothesis.

Regards,

Jeff ===================
Jeff Winter
Snr DSP Engineer
Aeroflex

www.aeroflex.com -----Original Message-----
From: matlab@matl... [mailto:matlab@matl...]On Behalf Of
acepsut@acep...
Sent: 03 June 2005 09:37
To: matlab@matl...
Subject: [matlab] Redundant Haar Wavelet Hello Everybody, I'm trying to replicate in Matlab code the Redundant Haar
Wavelet, as from the

http://strule.cs.qub.ac.uk/~gzheng/financial-engineering/finpapermay99.html

Following this statement,

"The non-decimated Haar algorithm is exactly the same as the trous
algorithm, except that the low-pass filter h, (1/16,1/4,3/8,1/4,1/16), is
replaced by the simpler filter (1/2, 1/2). There h is now non-symmetric."

I wrote this code in Matlab

appa';
for j = 0:4
for i = 1:l
if (i-2^j)==0
X = [app(i) app(1)];
else
X = [app(i) app(abs((i-2^j)))];
end
C(i)=(0.5*X(1)+0.5*X(2));
end
w((j+1),(1:l))=app(1:end)-C(1:end);
app = C;
end
D1 = w(1,(1:l));
D2 = w(2,(1:l));
D3 = w(3,(1:l));
D4 = w(4,(1:l));
D5 = w(5,(1:l));
A5 = C;

figure;
hold on;
plot(A5);
plot(A5+D5,'r-');
plot(A5+D5+D4,'g-');
plot(A5+D5+D4+D3,'y-');
plot(A5+D5+D4+D3+D2,'c-');
plot(A5+D5+D4+D3+D2+D1,'m-');

but there must be something wrong because I get lag when overplot the
details, while there shouldn't be any lag.

The symmetric version of the Haar do not show lag but it's not suitable
for finance application because of the distorsion effect on borders.

Any help is very much appreciated, thanks a lot!

Albert

PS I'm involved in financial market forecast using scientifics methods,
anyone interested in can contact me for collaboration, acepsut@acep...


Hi Jeff,
 
and thanks for your reply.
 
Well, using the symmetric haar h = [1/16 1/4 3/8 1/4 1/16] I do not have lag effects and coefficents are in phase perfectly but I get border effects that's unuseful to be trained with neural nets.
 
The same unuseful training is because of lag effects using the 1/2  1/2.
 
I wonder how do they do to get a perfect overlap of the coefficents as in figure 2 with a redundant haar a trous!
 
The trick is just to get a wavelets that is both lag-free and without border effect, but I have been unable to code.
 
Regards, Albert

 
2005/6/3, Jeff Winter <j...@aeroflex.com>:
Hi Albert,

If you ignore the lag, does the result look ok?

Non-symmetric filters introduce phase shifts.  The effect of a phase shift
is to displace events along the time axis; that is, if a maximum in the
original series occurs at time t0, the phase shifted maximum occurs at time
t0 + delta, where delta may be positive or negative.

So while the non-symmetric filter is important to detect edge boundaries in
this application, I think the delay is unavoidable.  However, from the look
of this paper a lot of the results show the effects of de-noising the
signal?  The (1/2, 1/2) filter coefficients are a simple averaging filter
that fit in with the de-noising hypothesis.

Regards,

Jeff

===================
Jeff Winter
Snr DSP Engineer
Aeroflex

www.aeroflex.com