clear all; close all;
%------------------ demo_leb_constant_equidistant.m --------------
% This routine plots the Lebesgue constant of F-H's interpolant at
% equidistant nodes on [0,1].
% 
% Functions called: weights, leb_constant
% 
%-----------------------------------------------------------------
% Authors: 
%      Stefano De Marchi and Cinzia Bandiziol
%      Department of Pure and Applied Math.
%      University of Padova
%   
% Version: May 2015		
%-----------------------------------------------------------------			

a=0; b=1;
d=3;
N=(1:100)';
lambda_n_vect=zeros(100,1);
for n=d+2:101
        x=linspace(a,b,n)';
        w=weights(d,x);
        [lambda_n,points]=leb_constant(a,b,n,x,w);
        lambda_n_vect(n-1)=lambda_n;
end

c=find(lambda_n_vect~=0);
plot(N(c),lambda_n_vect(c),'ob');
title('Lebesgue constant at equidistant nodes');
