bisynt4.m

来自「这是伯克里wavelet transforms一书中的例子的代码」· M 代码 · 共 52 行

M
52
字号
function bisy = bisynt4(sub,lpf,hpf)
%bisynt2(sub,lpf,hpf) reconstructs the one -level subband decomposed 
%signal denoted by sub using the synthesis filter bank defined by
%lpf and hpf. lpf and hpf are HSS and the input data is assumed to 
%have odd length. Symmetric extension has been used.
%
%This routine is used by the routine synthh.
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%

   l = length(sub); %length of the original signal
  ll = length(lpf); %length of the lowpass filter
  lh = length(hpf); %length of the highpass filter
  le = ll/2; %extension length for the lowpass subband
  he = lh/2; %extension length for the highpass subband

   a0 = sub(1:ceil(l/2)); %isolate the lowpass subband
   a1 = sub(ceil(l/2)+1:l); %isolate the highpass subband

 if (le/2 ~= round(le/2)) %even subband

   u0 = zeros([1 l]); %initialize the upsampling arrays
   u1 = zeros([1 l]); 

   u0(1:2:l) = a0; %upsample the lowpass subband
   u1(2:2:l) = a1; %upsample the highpass subband

   extl = [u0(le+1:-1:2) u0 0 u0(l:-1:max(1,l-le-1))]; %symmetric extension for lpf
   exth = [-u1(he:-1:1) 0 u1 -u1(l-1:-1:max(1,l-he-1))]; %symmetric extension for hpf

   r0 = conv(extl,lpf);
   r1 = conv(exth,hpf);

  bisy = r0(ll+1:ll+l)+r1(lh+1:lh+l);  %reconstructed signal
 else 

  u0 = zeros([1 l]); %upsample
  u1 = zeros([1 l]);

  u0(1:2:l) = a0;
  u1(2:2:l) = a1;

  extl = [u0(le-1:-1:1) 0 u0 u0(l-1:-1:max(1,l-le-1))]; %extension for low pass
  exth = [-u1(he+1:-1:2)  u1 0 -u1(l:-1:max(1,l-he-2))]; %extension for high pass

  r0 = conv(extl,lpf);
  r1 = conv(exth,hpf);

  bisy = r0(ll:ll+l-1)+r1(lh+1:lh+l);
end %end if

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?