Home > sgwt_toolbox > sgwt_kernel_abspline5.m

sgwt_kernel_abspline5

PURPOSE ^

sgwt_kernel_abspline5 : Monic polynomial / quintic spline / power law decay kernel

SYNOPSIS ^

function r = sgwt_kernel_abspline5(x,alpha,beta,t1,t2)

DESCRIPTION ^

 sgwt_kernel_abspline5 : Monic polynomial / quintic spline / power law decay kernel

 function r = sgwt_kernel_abspline5(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
 quintic spline for t1<x<t2,
 Satisfying g(t1)=g(t2)=1
 g'(t1)=g'(t2)
 g''(t1)=g''(t2)

 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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Tue 04-May-2010 16:00:20 by m2html © 2003