clear all; close all;
%--------------- demo_leb_function_extended_cheb.m -----------------
% This script plots the Lebesgue function of F-H's interpolant at
% 40 extended Chebychev 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;
g=inline('1/2*(1-cos((2*k+1)*pi/(2*n+2))./cos(pi/(2*n+2)))','n','k');

k_vect=(0:n-1)';
n_vect=n*ones(n,1);
x=g(n,k_vect);   
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 extended Chebychev nodes');