⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bisynt2.m

📁 这是伯克里wavelet transforms一书中的例子的代码
💻 M
字号:
function bisy = bisynt2(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 even 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

 if (le/2 ~= round(le/2)) %unequal subbands
   a0 = sub(1:l/2+1); %isolate the lowpass subband
   a1 = sub(l/2+2:l); %isolate the highpass subband

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

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

   extl = [u0(le+1:-1:2) u0 u0(l:-1:le)]; %symmetric extension for lpf
   exth = [-u1(he:-1:1) 0 u1 0 -u1(l-1:-1:he)]; %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
  a0 = sub(1:l/2);
  a1 = sub(l/2+1:l);

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

  u0(1:2:l) = a0;
  u1(2:2:l+1) = 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  -u1(l:-1:max(1,l-he-1))]; %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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -