%======================================= % DCT-1 : Discrete cosine transform %--------------------------------------- % Coefficients are same as defined by % 6.14 in the book % %======================================= function y=dct1(x) M =length(x); y =[x;flipud(x(2:M-1,:))]; y_ft =fft(y); y =real(y_ft(1:M,:)/(M-1)); y(1,:) = y(1,:)/2; y(M,:) = y(M,:)/2;