Home > Src > Basis_functions > plot_lagrange.m

plot_lagrange

PURPOSE ^

PLOT_LAGRANGE plots 1D Lagrange polynomials.

SYNOPSIS ^

function plot_lagrange

DESCRIPTION ^

 PLOT_LAGRANGE  plots 1D Lagrange polynomials.
             Formula (1.2.55), pag. 17, CHQZ2,
             produces part of Fig. 2.12, pag. 83 CHQZ2

     plot_lagrange   % no input, no output

 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 plot_lagrange
0002 % PLOT_LAGRANGE  plots 1D Lagrange polynomials.
0003 %             Formula (1.2.55), pag. 17, CHQZ2,
0004 %             produces part of Fig. 2.12, pag. 83 CHQZ2
0005 %
0006 %     plot_lagrange   % no input, no output
0007 %
0008 % Reference: CHQZ2 = C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang,
0009 %                    "Spectral Methods. Fundamentals in Single Domains"
0010 %                    Springer Verlag, Berlin Heidelberg New York, 2006.
0011 
0012 %   Written by Paola Gervasio
0013 %   $Date: 2007/04/01$
0014 %
0015 
0016 %
0017 addpath ../Level_0
0018 nx=4;
0019 xga=-1; xgb=1.;
0020 npdx=nx+1; 
0021 [xgl,wx]=xwlgl(npdx); 
0022 nx1=51;
0023 y=zeros(nx1,5);
0024 x=linspace(-1,1,nx1)';
0025 a=intlag_lgl(xgl, x);
0026 
0027 for i=1:npdx
0028 ygl=zeros(npdx,1); ygl(i)=1;
0029 y(:,i)=a*ygl;
0030 
0031 fig=figure(...,
0032     'Name','1D Lagrange polynomial',...
0033     'Visible','on');
0034 plot([-1.2,1.2],[0,0],'k'); hold on
0035 plot(xgl,zeros(npdx,1),'k+');
0036 plot(x,y(:,i),'k','LineWidth',3)
0037 set(gca,'DataAspectRatioMode','manual',...
0038 'DataAspectRatio',[1,1,1],...
0039 'XTickLabelMode','manual','XTickLabel',[],'XTick',[],...
0040 'YTickLabelMode','manual','YTickLabel',[],'YTick',[],...
0041 'color','none','xcolor',[1 1 1],'ycolor',[1 1 1],...
0042 'Box','off','FontName','Times','Fontsize',16)
0043 if mod(i,2)==1
0044 set(gca,'Ylimmode','manual','Ylim',[-.55,1.1])
0045 else
0046 set(gca,'Ylimmode','manual','Ylim',[-1.1,1.1])
0047 end
0048 h1=text(-1.2,-0.2,0.,'-1','FontName','Times','Fontsize',16);
0049 h2=text(.99,-0.2,0.,'1','FontName','Times','Fontsize',16);
0050 h3=text(.57,.8,0.,['L',num2str(i-1)],'FontName','Times','Fontsize',16);
0051 axis off
0052 nomefile=['figure2-lagrange',num2str(i-1)];
0053 %print(fig,'-depsc2',nomefile)
0054 
0055 end
0056 return

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