clear all; close all;
%----------------- demo_leb_function_cheb.m ----------------------
% This script plots the Lebesgue function of F-H's interpolant at
% 40 Chebychev-Gauss-Lobatto nodes on [0,1].
% 
% Functions called: weights, leb_function
%
%-----------------------------------------------------------------
% Authors: 
%      Stefano De Marchi and Cinzia Bandiziol
%      Department of Pure and Applied Math.
%      University of Padova
%           
% Version: May 2015		
%------------------------------------------------------------------		

d=3;
n=40;
F3=inline('(1-cos(pi*t))/2','t');

abscissa=(0:1/(n-1):1)';
x=F3(abscissa);%Chebychev-Gauss-Lobatto nodes
w=weights(d,x);
[lambda_n_fun,points]=leb_function(min(x),max(x),n,x,w);

plot(points,lambda_n_fun,'b-');
title('Lebesgue function at Chebychev-Gauss-Lobatto nodes');