10 views (last 30 days)

Wayne King
on 30 Jul 2012

Edited: Wayne King
on 30 Jul 2012

Hi Lorena, you have to determine the equivalent filter at each level of the wavelet tree. As a simple example, I'll show you how to compare the db4 scaling filter at level 1 and level 2.

Note to get the equivalent scaling filter at level 2 you have to lowpass filter at level 1 followed by downsampling by two and then lowpass filter for level 2.

[LoD,HiD] = wfilters('db4');

[H1,W1] = freqz(LoD);

% getting the equivalent impulse response for level 2

scal2 = conv(upsample(LoD,2),LoD)./sqrt(2);

[H2,W2] = freqz(scal2);

plot(W1,abs(H1),'k'); hold on;

plot(W2,abs(H2),'r');

legend('Level 1 Scaling Filter','Level 2 Scaling Filter');

xlabel('Radians/sample'); ylabel('Magnitude');

This is for 1st and 2nd level db4 wavelet (detail) filters.

[LoD,HiD] = wfilters('db4');

[H1,W1] = freqz(HiD);

% getting the equivalent impulse response for level 2

wav2 = conv(upsample(HiD,2),LoD)./sqrt(2);

[H2,W2] = freqz(wav2);

plot(W1,abs(H1),'k'); hold on;

plot(W2,abs(H2),'r');

axis tight;

legend('Level 1 Wavelet Filter','Level 2 Wavelet Filter', ...

'Location','SouthEast');

xlabel('Radians/sample'); ylabel('Magnitude');

choma community
on 17 Oct 2012

Sign in to comment.

Miguel Alfonso Mendez
on 28 Mar 2017

Edited: Miguel Alfonso Mendez
on 28 Mar 2017

Very interesting answer. Could you continue with the level 3 ?

For example, should the level 3 approximation be

scal3=conv(upsample(scal2,2),LoD)./sqrt(2) ?

In this case the length of the impulse response is 53, but It should be 50.

I am missing something :(

I also add one more question: Downsampling and then filtering by a filter having transfer function G(z) should be equal to filter by G(z^2). Therefore the second level low pass filter should have transfer function G(z)*G(z^2), no ? Similarly the second level high pass should have G(z)*H(z^2).

Therefore, I would be tempted to compute the transfer function at level 2 as follow:

% Level 1

[LoD,HiD] = wfilters('db4'); %Impulse Response

[Hl,Wl] = freqz(LoD); % Low Frequency Part

[Hh,Wh] = freqz(HiD); % High Freq Part

z=Wl/pi; %Take the z axis

G=abs(Hl)/max(abs(H1)); %Transfer Function Filter 'Low'

LL=G.*interp1(z.^2,G,z); %Transfer Function Filter 'Low'*'Low'

% Filter LH:

H=abs(Hh)/max(abs(Hh)); %Transfer Function Filter 'Low'

LH=G.*interp1(z.^2,H,z); %Transfer Function Filter 'Low'*'High'

figure(1)

plot(z,LH,'k') %Low*High

hold on

plot(z,LL,'r') %Low*Low

Now... this is giving a very different result from what you have proposed: where is the mistake ?

Thank you

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.