function plot_omega( n ) %function plot_omega( n ) % % Matlab function to plot the term from the Chebyshev minimax problem: % % | omega(t) | = | (t-t[0]) * ... * (t-t[n]) | % % for equi-spaced vs Chebyshev vs modified Chebyshev nodes on [-1,1] % for the input value of 'n'. % % C.G. (11-96) % m = 1000 ; t = [ 0 : m ]' * 2 / m - 1 ; % number/vector of sample points % % put the different node sets in the columns of the array tau. % tau = zeros( n + 1, 3 ) ; % initialize an array of the proper dimensions tau(:,1) = [ 0 : n ]' * 2 / n - 1 ; % equally spaced nodes on [-1,1] tau(:,2) = - cos( ( 2 * [0:n]' + 1 ) * pi / ( 2 * n + 2 ) ) ; % Chebyshev nodes tau(:,3) = - cos( [ 0 : n ]' * pi / n ) ; % modified Chebyshev nodes % % evaluate the 3 |omega(t)| functions on the sample points. % omega = zeros( m + 1, 3 ) ; % initialize an array of the proper dimensions for k = 1 : 3 omega(:,k) = abs( polyval( poly( tau(:,k) ), t ) ) ; end clf , plot( t, omega ) title( [ 'Chebyshev vs Equally Spaced, ', '|\omega({\it{x}})|, ', ... '{\it{n}} = ', num2str(n) ] ) xlabel('{\it x}') , ylabel('{\it y}')