%plots Chebyshev polynomials of degree 2,4,6,8

n = [2,4,6,8];

x = linspace(-1,1,1000);
y = zeros(4,1000);

for i=1:4
    for j=1:1000
        y(i,j) = cos(n(i)*acos(x(j)));
    end
end

z = zeros(1,1000);

subplot(2,2,1)
plot(x,y(1,:),x,z,'r')
title('T_2')
subplot(2,2,2)
plot(x,y(2,:),x,z,'r')
title('T_4')
subplot(2,2,3)
plot(x,y(3,:),x,z,'r')
title('T_6')
subplot(2,2,4)
plot(x,y(4,:),x,z,'r')
title('T_8')
        
    