MATLAB Answers

Daubechies filters: Frequency response

16 views (last 30 days)
Lorena
Lorena on 30 Jul 2012
I need to know the frequency response of Db4 (6 levels) filters. I mean, I need to know the amplitude of the power spectral density (or similar) vs frequency (Hz)[using the frqz comand] for each of the levels of the Daubechies 4. Some one know how to do this?????

  0 Comments

Sign in to comment.

Accepted Answer

Wayne King
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');

  2 Comments

Lorena
Lorena on 31 Jul 2012
Hi Wayne, thanks your code works excellent, it saved me!!!!!!
choma community
choma community on 17 Oct 2012
please help me wayne, I need to know the frequency response of gabor wavelet and linear predictive coding (LPC)...

Sign in to comment.

More Answers (1)

Miguel Alfonso Mendez
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

  0 Comments

Sign in to comment.

Sign in to answer this question.