sgwt_cheby_coeff : Compute Chebyshev coefficients of given function function c=sgwt_cheby_coeff(g,m,N,arange) Inputs: g - function handle, should define function on arange m - maximum order Chebyshev coefficient to compute N - grid order used to compute quadrature (default is m+1) arange - interval of approximation (defaults to [-1,1] ) Outputs: c - array of Chebyshev coefficients, ordered such that c(j+1) is j'th Chebyshev coefficient
0001 % sgwt_cheby_coeff : Compute Chebyshev coefficients of given function 0002 % 0003 % function c=sgwt_cheby_coeff(g,m,N,arange) 0004 % 0005 % Inputs: 0006 % g - function handle, should define function on arange 0007 % m - maximum order Chebyshev coefficient to compute 0008 % N - grid order used to compute quadrature (default is m+1) 0009 % arange - interval of approximation (defaults to [-1,1] ) 0010 % 0011 % Outputs: 0012 % c - array of Chebyshev coefficients, ordered such that c(j+1) is 0013 % j'th Chebyshev coefficient 0014 0015 % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 0016 % Copyright (C) 2010, David K. Hammond. 0017 % 0018 % The SGWT toolbox is free software: you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation, either version 3 of the License, or 0021 % (at your option) any later version. 0022 % 0023 % The SGWT toolbox is distributed in the hope that it will be useful, 0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0026 % GNU General Public License for more details. 0027 % 0028 % You should have received a copy of the GNU General Public License 0029 % along with the SGWT toolbox. If not, see <http://www.gnu.org/licenses/>. 0030 0031 function c=sgwt_cheby_coeff(g,m,N,arange) 0032 if ~exist('N','var') 0033 N=m+1; 0034 end 0035 if ~exist('arange','var') 0036 arange=[-1, 1]; 0037 end 0038 a1=(arange(2)-arange(1))/2; 0039 a2=(arange(2)+arange(1))/2; 0040 for j=1:m+1 0041 c(j)=sum (g(a1* cos( (pi*((1:N)-0.5))/N) + a2).*cos(pi*(j-1)*((1:N)-.5)/N) )*2/N; 0042 end 0043