sgwt_kernel_abspline3 : Monic polynomial / cubic spline / power law decay kernel function r = sgwt_kernel_abspline3(x,alpha,beta,t1,t2) defines function g(x) with g(x) = c1*x^alpha for 0<x<x1 g(x) = c3/x^beta for x>t2 cubic spline for t1<x<t2, Satisfying g(t1)=g(t2)=1 Inputs : x : array of independent variable values alpha : exponent for region near origin beta : exponent decay t1, t2 : determine transition region Outputs : r - result (same size as x)
0001 % sgwt_kernel_abspline3 : Monic polynomial / cubic spline / power law decay kernel 0002 % 0003 % function r = sgwt_kernel_abspline3(x,alpha,beta,t1,t2) 0004 % 0005 % defines function g(x) with g(x) = c1*x^alpha for 0<x<x1 0006 % g(x) = c3/x^beta for x>t2 0007 % cubic spline for t1<x<t2, 0008 % Satisfying g(t1)=g(t2)=1 0009 % 0010 % Inputs : 0011 % x : array of independent variable values 0012 % alpha : exponent for region near origin 0013 % beta : exponent decay 0014 % t1, t2 : determine transition region 0015 % 0016 % Outputs : 0017 % r - result (same size as x) 0018 0019 % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 0020 % Copyright (C) 2010, David K. Hammond. 0021 % 0022 % The SGWT toolbox is free software: you can redistribute it and/or modify 0023 % it under the terms of the GNU General Public License as published by 0024 % the Free Software Foundation, either version 3 of the License, or 0025 % (at your option) any later version. 0026 % 0027 % The SGWT toolbox is distributed in the hope that it will be useful, 0028 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0030 % GNU General Public License for more details. 0031 % 0032 % You should have received a copy of the GNU General Public License 0033 % along with the SGWT toolbox. If not, see <http://www.gnu.org/licenses/>. 0034 0035 function r = sgwt_kernel_abspline3(x,alpha,beta,t1,t2) 0036 r=zeros(size(x)); 0037 % compute spline coefficients 0038 % M a = v 0039 M=[[1 t1 t1^2 t1^3];... 0040 [1 t2 t2^2 t2^3];... 0041 [0 1 2*t1 3*t1^2];... 0042 [0 1 2*t2 3*t2^2]]; 0043 %v=[t1^alpha ; t2^(-beta) ; alpha*t1^(alpha-1) ; -beta*t2^(-beta-1)]; 0044 v=[1 ; 1 ; t1^(-alpha)*alpha*t1^(alpha-1) ; -beta*t2^(-beta-1)*t2^beta]; 0045 a=M\v; 0046 0047 r1=find(x>=0 & x<t1); 0048 r2=find(x>=t1 & x<t2); 0049 r3=find(x>=t2); 0050 r(r1)=x(r1).^alpha*t1^(-alpha); 0051 r(r3)=x(r3).^(-beta)*t2^(beta); 0052 0053 x2=x(r2); 0054 r(r2)=a(1)+a(2)*x2+a(3)*x2.^2+a(4)*x2.^3; 0055 % tmp=polyval(flipud(a),x2); 0056 % keyboard