bianal1.m

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

M
44
字号
function bian = bianal1(data,lpf,hpf)
%bianal1(data,lpf,hpf) effects a one level decomposition of 
%of the input signal, data, using the biorthogonal filter bank
%defined by filters lpf and hpf. The filters are assumed to be 
%WSS and the extension is WSS symetric extension. The length of
%data is even.
%
%This routine is used by analw for biorthigonal wavelet decomposition.
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%

  l = length(data); %length of the input data

  ll = length(lpf); %length of lowpass filter
  lh = length(hpf); %length of highpass filter

  if ll>lh
     d0 = 0;
     d1 = 1;
  else
     d0 = 1;
     d1 = 0;
  end %endif
  %this finishes choosing the appropriate delays for the 
  %subbands.

  le = (ll-1)/2; %extension length for lpf
  he = (lh-1)/2; %extension length for hpf

  ext = [data(le+1:-1:2) data data(l-1:-1:l-le-1)];
  %symmetric WSS extension for the lpf

 s = conv(ext,lpf); %get the lowpass subband
 bian = s(ll+d0:2:ll+l+d0-1); %downsample

 ext = [data(he+1:-1:2) data data(l-1:-1:l-he-1)];
 %symmetric WSS extension for the hpf

 s = conv(ext,hpf); %get highpass subband
 s = s(lh+d1:2:lh+l+d1-2); %downsample

 bian = [bian s];

⌨️ 快捷键说明

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