% Error Polynomial for Equidistant and for Chebychev Nodes
%
% Lab Session 5 Problem 1

phi = pi/20 * [0:20];
n = length(phi);
xcheb = 5*cos(phi);
xequi = [-5:0.5:5]; 

xx = [-5:0.05:5];
pc = polyval(poly(xcheb),xx);
pe = polyval(poly(xequi),xx);

title "Error Polynomial"
plot(xx,pc,";Chebychev Nodes;",xx,pe,";Equidistant Nodes;")