📄 synthh.m
字号:
function sy = synthh(anal,sl,sh,levs)
%Routine to reconstruct the signal from its multilevel DWT using
%an even length or half sample symmetric (HSS) biorthogonal filter bank.
%Symmetric extension used to extend the subbands. This routine
%complements the analysis routine 'analh'.
%
%sy = synthh(an,lpf,hpf,L) reconstructs the original signal from
%its DWT, 'an', which could be the output of the analysis routine 'analh'.
%The signal is assumed to be decomposed to L levels. The HSS filter
%bank used is comprised of lpf and hpf. If this corresponds to the
%analysis filter bank used for decomposition then you get perfect
%reconstruction.
%
%sy = synthh(an,fopt,L) reconstructs the original signal from
%its DWT, 'an', which could be the output of the analysis routine 'analh'.
%The signal is assumed to be decomposed to L levels.
%fopt chooses a HSS synthesis filter bank provided in the routine.
%If this corresponds to the analysis filter bank used for the
%decomposition then you get perfect reconstruction.
%
%The final result of the synthesis procedure is plotted in the end.
%
%The input variables are
%an : L-level DWT
%lpf, hpf: these two filters define the synthesis filter bank
%OR
%fopt :Takes the values of 1,2 or 3 and correspond to the 6/2 and
% 2/6 and 4/4 tap filter banks respectively.
%L : Number of levels of decomposition and hence synthesis.
%
%Refer to Chapter 4 for more information on biorthogonal wavelet
%decomposition and reconstruction.
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%
num = nargin; %number of input arguments
%if the number of input arguments is 3 then use the second argument to
%pick up the filter bank and the third argument gives the number of levels
if (num ==3)
levs = sh;
if(sl == 1)
sl =[-0.17677669529664 0.17677669529664 0.70710678118655 0.70710678118655 0.17677669529664 -0.17677669529664];
sh =[-0.70710678118655 0.70710678118655];
elseif (sl ==2)
sl =[0.70710678118655 0.70710678118655];
sh =[-0.17677669529664 -0.17677669529664 0.70710678118655 -0.70710678118655 0.17677669529664 0.17677669529664];
elseif (sl >=3)
if (sl > 3)
fprintf('fopt chosen to be greater than 3. Using fopt=3 instead\n');
end;
sl =[-0.35355339059327 1.06066017177982 1.06066017177982 -0.35355339059327];
sh =[-0.17677669529664 0.53033008588991 -0.53033008588991 0.17677669529664];
end %end inner if
end %enf if
l = length(anal);
lens = [l]; %initialization
%Now determine the lengths of each subband
for i=1:(levs-1)
if ( length(sh)/4 == round(length(sh)/4)) %center odd
if (l/2 == round(l/2)) %length of data even
l = l/2;
else %length odd
l = (l+1)/2;
end %end inner if
else %center even
if (l/2 == round(l/2)) %length of data even
l =l/2 + 1;
else
l = (l + 1)/2;
end %end inner if
end %end outer if
lens = [l lens]; %append the newly computed length to the list
end %end for
%Now begin the synthesis process
for i=1:levs
sy = anal(1:lens(i));
if (lens(i)/2 == round(lens(i)/2) ) %even length
sy = bisynt2(sy,sl,sh); %One level synthesis for even length
else %odd length
sy = bisynt4(sy,sl,sh); %one level synthesis for odd length
end %end if
anal(1:lens(i)) = sy; %update the analysis array with the newly
end %end for %synthesized subband
%plot the eventual signal
figure;plot(sy);title('IDWT of Input DWT Array');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -