clear all; close all;
%----------------- demo_leb_constant_log.m -----------------------
% This script plots the Lebesgue constant of F-H's interpolant at
% logarithmically distributed nodes.
% 
% Function called: weights, leb_constant
% 
%-----------------------------------------------------------------
% Authors: 
%      Stefano De Marchi and Cinzia Bandiziol
%      Department of Pure and Applied Math.
%      University of Padova
%           
% Version: May 2015		
%  ----------------------------------------------------------------		

d=3;
F2=inline('log(1+t*(exp(1)-1))','t');% distribution function of logarithmically distributed nodes

N=(1:100)';
lambda_n_vect=zeros(100,1);
for n=d+2:101
abscissa=(0:1/(n-1):1)';%equidistant points in [0,1]
x=F2(abscissa);%logarithmically distributed nodes
w=weights(d,x);
[lambda_n,points]=leb_constant(min(x),max(x),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 logarithmically distributed nodes');