%DCT basis functions
clear all
figure(1);clf

n=8;
x=0:0.01:n-1;

for i=0:n-1

    subplot(8,1,i+1);
    plot(x,cos(pi/n*(x+0.5)*i),'linewidth',2);
    set(gca,'xlim',[0 n-1],'ylim',[-1.2,1.2])
    line([0 n-1],[0 0],'color','k')

    box off
    text(n-1,0,num2str(i))

    if (i<7 )
        set(gca,'xtick',[], 'ytick', [-1 1],'color','none','xcolor',get(gcf,'color'))
    else
        set(gca, 'ytick', [-1 1],'color','none')
        xlabel('Sample number')
    end

    if(i==0)
        text(n/3,2.5,'DCT-II 8-point')
    end
end