Home > sgwt_toolbox > sgwt_filter_design.m

sgwt_filter_design

PURPOSE ^

sgwt_filter_design : Return list of scaled wavelet kernels and derivatives

SYNOPSIS ^

function [g,gp,t]=sgwt_filter_design(lmax,Nscales,varargin)

DESCRIPTION ^

 sgwt_filter_design : Return list of scaled wavelet kernels and derivatives
 g{1} is scaling function kernel, 
 g{2} ... g{Nscales+1} are wavelet kernels

 function [g,gp]=sgwt_filter_design(lmax,Nscales,varargin)

 Inputs :
 lmax - upper bound on spectrum
 Nscales - number of wavelet scales

 selectable parameters : 
 designtype
 lpfactor - default 20. lmin=lmax/lpfactor will be used to determine
            scales, then scaling function kernel will be created to
            fill the lowpass gap.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % sgwt_filter_design : Return list of scaled wavelet kernels and derivatives
0002 % g{1} is scaling function kernel,
0003 % g{2} ... g{Nscales+1} are wavelet kernels
0004 %
0005 % function [g,gp]=sgwt_filter_design(lmax,Nscales,varargin)
0006 %
0007 % Inputs :
0008 % lmax - upper bound on spectrum
0009 % Nscales - number of wavelet scales
0010 %
0011 % selectable parameters :
0012 % designtype
0013 % lpfactor - default 20. lmin=lmax/lpfactor will be used to determine
0014 %            scales, then scaling function kernel will be created to
0015 %            fill the lowpass gap.
0016 
0017 % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox)
0018 % Copyright (C) 2010, David K. Hammond.
0019 %
0020 % The SGWT toolbox is free software: you can redistribute it and/or modify
0021 % it under the terms of the GNU General Public License as published by
0022 % the Free Software Foundation, either version 3 of the License, or
0023 % (at your option) any later version.
0024 %
0025 % The SGWT toolbox is distributed in the hope that it will be useful,
0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 % GNU General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License
0031 % along with the SGWT toolbox.  If not, see <http://www.gnu.org/licenses/>.
0032 
0033 function [g,gp,t]=sgwt_filter_design(lmax,Nscales,varargin)
0034 control_params={'designtype','default','lpfactor',20,...
0035     'a',2,...
0036     'b',2,...
0037     't1',1,...
0038     't2',2,...
0039     };
0040 argselectAssign(control_params);
0041 argselectCheck(control_params,varargin);
0042 argselectAssign(varargin);
0043 
0044 switch designtype
0045     case 'default'
0046         lmin=lmax/lpfactor;
0047         t=sgwt_setscales(lmin,lmax,Nscales);
0048         gl = @(x) exp(-x.^4);
0049         glp = @(x) -4*x.^3 .*exp(-x.^4);
0050         gb= @(x) sgwt_kernel(x,'a',a,'b',b,'t1',t1,'t2',t2);
0051         gbp = @(x) sgwt_kernel_derivative(x,'a',a,'b',b,'t1',t1,'t2',t2);
0052         for j=1:Nscales
0053             g{j+1}=@(x) gb(t(end+1-j)*x);
0054             gp{j+1}=@(x) gbp(t(end+1-j)*x)*t(end+1-j); % derivative
0055         end
0056         % find maximum of g's ...
0057         % I could get this analytically as it is a cubic spline, but
0058         % this also works.
0059         f=@(x) -gb(x);
0060         xstar=fminbnd(f,1,2);
0061         gamma_l=-f(xstar);
0062         lminfac=.6*lmin;
0063         g{1}=@(x) gamma_l*gl(x/lminfac);
0064         gp{1} = @(x) gamma_l*glp(x/lminfac)/lminfac; % derivative
0065  case 'mh'
0066   lmin=lmax/lpfactor;
0067   t=sgwt_setscales(lmin,lmax,Nscales);
0068   gb=@(x) sgwt_kernel(x,'gtype','mh');
0069   gl = @(x) exp(-x.^4);
0070   for j=1:Nscales
0071     g{j+1}=@(x) gb(t(end+1-j)*x);
0072   end
0073   lminfac=.4*lmin;
0074   g{1}=@(x) 1.2*exp(-1)*gl(x/lminfac);
0075   
0076  otherwise
0077   
0078         keyboard
0079         error('Unknown design type');
0080 end

Generated on Wed 13-Oct-2010 13:36:39 by m2html © 2003