Home > Src > Level_0 > intlag_lgl.m

intlag_lgl

PURPOSE ^

INTLAG_LGL Computes matrix "a" to evaluate 1D Lagrange interpolant at LGL

SYNOPSIS ^

function [a]=intlag_lgl(x_lgl, x_new);

DESCRIPTION ^

 INTLAG_LGL  Computes matrix "a" to evaluate 1D Lagrange interpolant at LGL
 (Legendre Gauss Lobatto)  nodes in [-1,1] at another mesh x_new in [-1,1]
             (formula (1.2.55)  pag. 17 CHQZ2)

  [a]=intlag_lgl(x_lgl, x_new)

 Input: x_lgl = array of np_lgl LGL nodes in [-1,1]
        x_new = array of np_new another set in [-1,1]

 Output: a = matrix of size (np_new,np_lgl) 

       If u_lgl is the array with evaluations  of a function u at nodes
          x_lgl, it holds:  u_new = a * u_lgl, i.e. u_new=u(x_new)

 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 [a]=intlag_lgl(x_lgl, x_new);
0002 % INTLAG_LGL  Computes matrix "a" to evaluate 1D Lagrange interpolant at LGL
0003 % (Legendre Gauss Lobatto)  nodes in [-1,1] at another mesh x_new in [-1,1]
0004 %             (formula (1.2.55)  pag. 17 CHQZ2)
0005 %
0006 %  [a]=intlag_lgl(x_lgl, x_new)
0007 %
0008 % Input: x_lgl = array of np_lgl LGL nodes in [-1,1]
0009 %        x_new = array of np_new another set in [-1,1]
0010 %
0011 % Output: a = matrix of size (np_new,np_lgl)
0012 %
0013 %       If u_lgl is the array with evaluations  of a function u at nodes
0014 %          x_lgl, it holds:  u_new = a * u_lgl, i.e. u_new=u(x_new)
0015 %
0016 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
0017 %                    "Spectral Methods. Fundamentals in Single Domains"
0018 %                    Springer Verlag, Berlin Heidelberg New York, 2006.
0019 
0020 %   Written by Paola Gervasio
0021 %   $Date: 2007/04/01$
0022 
0023 np_lgl=length(x_lgl);
0024 np_new=length(x_new);
0025 n_lgl=np_lgl-1;
0026 a=zeros(np_new,np_lgl);
0027 nnp1=1/(n_lgl*np_lgl);
0028 
0029 pn=pnleg(x_lgl,n_lgl);
0030 pn1=pnleg1(x_new,n_lgl);
0031 for i=1:np_new
0032     for j=1:np_lgl
0033 if abs(x_lgl(j)-x_new(i))>1.e-14
0034 a(i,j)=nnp1*(1-x_new(i)^2)*pn1(i)/((x_lgl(j)-x_new(i))*pn(j));
0035 else
0036  a(i,j)=1;   
0037 end
0038     end
0039 end
0040 
0041 return

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