Home > Src > Level_0 > dercgl.m

dercgl

PURPOSE ^

DERCGL Spectral (Chebyshev Gauss Lobatto) derivative matrix

SYNOPSIS ^

function [d] = dercgl(x,np)

DESCRIPTION ^

DERCGL      Spectral (Chebyshev Gauss Lobatto) derivative matrix 

    [D]=DERCGL(X,NP) returns the spectral derivative
    matrix D at the NP CGL nodes X (in [-1,1]). NP-1 is the polynomial
    degree used. Chebyshev Gauss Lobatto (CGL) grid ORDERED FROM LEFT TO RIGHT


 Input: x = array of CGL nodes on [-1,1] (computed by xwcgl)
        np = number of CGL nodes (=n+1, n=polynomial interpolation degree)

 Output: d = spectral derivative matrix: formula  (2.4.31), pag. 89 CHQZ2

 Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
                    "Spectral Methods. Fundamentals in Single Domains"
                    Springer Verlag, Berlin Heidelberg New York, 2006.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [d] = dercgl(x,np) 
0002 %DERCGL      Spectral (Chebyshev Gauss Lobatto) derivative matrix
0003 %
0004 %    [D]=DERCGL(X,NP) returns the spectral derivative
0005 %    matrix D at the NP CGL nodes X (in [-1,1]). NP-1 is the polynomial
0006 %    degree used. Chebyshev Gauss Lobatto (CGL) grid ORDERED FROM LEFT TO RIGHT
0007 %
0008 %
0009 % Input: x = array of CGL nodes on [-1,1] (computed by xwcgl)
0010 %        np = number of CGL nodes (=n+1, n=polynomial interpolation degree)
0011 %
0012 % Output: d = spectral derivative matrix: formula  (2.4.31), pag. 89 CHQZ2
0013 %
0014 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
0015 %                    "Spectral Methods. Fundamentals in Single Domains"
0016 %                    Springer Verlag, Berlin Heidelberg New York, 2006.
0017 
0018 %   Written by Paola Gervasio
0019 %   $Date: 2007/04/01$
0020   
0021 
0022 n=np-1; 
0023 x=x(:);
0024 
0025 if n==0 d=0;  return; end; 
0026 
0027 c=[2;ones(n-1,1);2];
0028 for j=2:n
0029 d(j,j)=-x(j)/(2*(1-x(j)^2));
0030 end
0031 for j=1:np
0032 xj=x(j);
0033 for l=1:j-1
0034 d(j,l)=c(j)/c(l)*(-1)^(l+j)/(xj-x(l));
0035 end
0036 for l=j+1:np
0037 d(j,l)=c(j)/c(l)*(-1)^(l+j)/(xj-x(l));
0038 end
0039 end
0040 d(np,np)=(2*n^2+1)/6;
0041 d(1,1)=-d(np,np);
0042 d(1,np)=(-1)^(np+1)/(x(1)-x(np));
0043 d(np,1)=-d(1,np);
0044 return

Generated on Fri 21-Sep-2007 10:07:00 by m2html © 2003