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

📄 bisynt1.m

📁 这是伯克里wavelet transforms一书中的例子的代码
💻 M
字号:
function bisy = bisynt1(sub,lpf,hpf)
%sy= bisynt1(sub,lpf,hpf) takes the one level
%subband decomposed signal sub and reconstructs 
%the original signal using a synthesis filter bank 
%defined by lpf and hpf. The filters are WSS and 
%the extensions are accordingly defined. The signal 
%is even length. The result is returned to array sy. 
%The subbands are symmetrically extended.
%
%This routine is used by synthw for the synthesis of 
%wavelet decomposed sequences. 
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%

  l  = length(sub); %length of the subband signal.
  ll = length(lpf); %length of the lowpass filter
  lh =  length(hpf); %length of the highpass filter
  le =  (ll-1)/2; %extension length for lpf
  he =  (lh-1)/2; %extension length for hpf
   
  low = sub(1:l/2); %lowpass subband isolated
  hi  = sub(l/2+1:l); %highpass subband isolated
  
  lu = zeros([1 l]); %upsample the lowpass subband
  lu(1:2:l) = low;

  hu = zeros([1 l]); %upsample the highpass subband
  hu(1:2:l-1) = hi;

 if ll<lh %or, for analysis filters ll>lh 
    extl = [lu(le+1:-1:2) lu lu(l-1:-1:max(1,l-le-1))]; %extension for lpf
    exth = [hu(he:-1:1) 0 hu hu(l-3:-1:max(1,l-he-4))]; %extension for hpf

  else %when in analysis side, ll<lh
    extl = [lu(le:-1:1) 0 lu lu(l-3:-1:max(1,l-le-4))]; %extension for lpf
    exth = [hu(he+1:-1:2) hu hu(l-1:-1:max(1,l-he-1))]; %extension for hpf    
   
  end
    r0 = conv(extl,lpf); %reconstruct the lowpass part
    r1 = conv(exth,hpf); %reconstruct the highpass part
    bisy =  r0(ll:ll+l-1)+r1(lh:lh+l-1); %reconstruct the signal    
  

⌨️ 快捷键说明

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