function C = makeDCTMatrix(n)

C = zeros(n, n);

for i = 0:n-1
    if (i == 0)
        a = 1/sqrt(2);
    else
        a = 1;
    end
    for j = 0:n-1
        C(i+1,j+1) = sqrt(2/n)*a*cos((i*(2*j + 1)*pi)/(2*n));
    end
end