Info

此问题已关闭。 请重新打开它进行编辑或回答。

Does the wavelet toolbox have a function to extract the approximation filter kernels for a specified level?

1 次查看(过去 30 天)
I would like to have the filter kernel for say, the level 6 approximation (A6) so that I can perform convolution filtering of some signal in another application, like Excel. Is there a function in the wavelet tool box that will give me the kernel directly?
If I use the code below with a 315 sample raw signal Raw, the vector scaleA2 should be the kernel for the level 2 approximation.
load sym4;
[Ld Hd Lr Hr]=orthfilt(sym4);
scaleA2=conv(conv(conv(Ld,dyadup(Ld,0)),dyadup(Lr,0)),Lr);
scaleA2=scaleA2/norm(scaleA2)/2;
When I convolve it with the raw signal using
fltr=wkeep(conv(Raw,scaleA2),315);
and compare fltr to A2 produced from
[C,L]=wavedec(Raw,5,'sym4');
A2=wrcoef('a',C,L,'sym4',2);
The two are close, but different. What's up???
  1 个评论
Wayne King
Wayne King 2013-3-1
Will you say "filter kernel" here, I assume you mean the filter impulse response. So you given an FIR scaling filter, h(n), you would like to know how to obtain the scaling filter at a specified level. Is that correct?

回答(1 个)

Wayne King
Wayne King 2013-3-2
I'm not sure why you are trying to use the synthesis filter here. That does not give you the equivalent filter for the scaling or wavelet filter at a given level of resolution.
The synthesis filter is used for aliasing cancellation and ultimately yields a vector projection onto a particular subspace.
You can get the equivalent filter you want this way:
[h,~] = wfilters('sym4');
L = 6;
%%Using the multirate noble identities
tmp = h;
for k = 1:L-1
tmp = dyadup(tmp,0);
h = conv(h,tmp);
h = 1/sqrt(2)*h;
end
%%Look at the frequency response
% Compare the frequency response of the scaling filter and
% the equivalent frequency response at level 6.
[LoD,~] = wfilters('sym4');
Horig = fft(LoD,1024);
Horig = Horig(1:1024/2+1);
Hfinal = fft(h,1024);
Hfinal = Hfinal(1:1024/2+1);
W = 0:(2*pi)/1024:pi;
plot(W,abs(Horig),'r','linewidth',2);
hold on;
plot(W,abs(Hfinal))
legend('Scaling filter','Equivalent filter at level 6');
set(gca,'xtick',[pi/2^L pi/2 pi]);
xlabel('Radians/sample');
grid on;
% Zoom in on the frequency response of the level-6 equivalent filter
figure;
plot(W,abs(Hfinal))
set(gca,'xlim',[0 pi/2^(L-2)]);
set(gca,'xtick',[pi/2^L pi/2^(L-1)])
xlabel('Radians/sample');
grid on;
title('Equivalent Scaling Filter at Level 6');

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by