bianal2.m

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

M
34
字号
function bian=bianal2(data,lpf,hpf)
%bianal2(data,lpf,hpf) performs a 1 level analysis 
%on the data using the filter bank defined by lpf and
%hpf. lpf and hpf are assumed to be HSS and so the 
%extension is symmetric and has twice the length of
%the original. The subbands are also of unequal length.
%
%This routine is used by analh.
%
%Author: Ajit S. Bopardikar
%Copyright (c) 1998 by Addison Wesley Longman, Inc.
%

  l = length(data); %Get the data length
  ll = length(lpf); %lowpass filter length
  lh = length(hpf); %highpass filter length

  le = ll/2; %extension length for low pass
  he = lh/2; %extension length for high pass

  extl = [data(le:-1:1) data data(l:-1:l-le+1)];%extension for lowpass 
  exth = [data(he:-1:1) data data(l:-1:l-he+1)];%extension for highpass
  al = conv(extl,lpf); %lowpass subband
  ah = conv(exth,hpf); %highpass subband

  if (le/2 ~= round(le/2)) %if the center is odd     
     bian = al(ll:2:ll+l); %downsampled lowpass subband
     bian = [bian ah(lh+2:2:lh+l-1)]; %unequal length subbands
  else   %if center is even
     bian = al(ll+1:2:ll+l); %downsample lowpass subband
     bian = [bian ah(lh+1:2:lh+l-1)]; %equal length subbands
  end; %endif

⌨️ 快捷键说明

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