y=dct(x, n) t(x)returns the unitary discrete cosine transform of (2n-1)(k-1) where k=1 w(k) 2≤k≤N N n is the length of x, and x and y are the same size. If x is a matrix, dct transforms its columns. The series is indexed from n=l and k =1 instead of the usual n =0 andk=o because matlaB vectors run from 1 to n instead of from o to n-1 y=dct(x, n) pads or truncates x to length n before transforming The dcT is closely related to the discrete Fourier transform. You can often reconstruct a sequence very accurately from only a few DCT coefficients, a useful property for applications requiring data Find how many DCT coefficients represent 99% of the energy in a sequence:x=(1: 100)+ 0*cos(1:100)*2*p/40) [XX, ind]=sort(abs( X)); ind=fliplr(ind) whilenorm([X(ind(1: i))zeros(1, 100-1))Norm(X.99)y = dct(x,n) Description y = dct(x) returns the unitary discrete cosine transform of x ( ) ( ) ( ) ( )( ) 1 2 1 1 cos , 1, , 2 N n n k y k w k x n k N N = − − = = where ( ) 1 , 1 2 , 2 k N w k k N N = = N is the length of x, and x and y are the same size. If x is a matrix, dct transforms its columns. The series is indexed from n = 1 and k = 1 instead of the usual n = 0 and k = 0 because MATLAB vectors run from 1 to N instead of from 0 to N- 1. y = dct(x,n) pads or truncates x to length n before transforming. The DCT is closely related to the discrete Fourier transform. You can often reconstruct a sequence very accurately from only a few DCT coefficients, a useful property for applications requiring data reduction. Examples Find how many DCT coefficients represent 99% of the energy in a sequence: x = (1:100) + 50*cos((1:100)*2*pi/40); X = dct(x); [XX,ind] = sort(abs(X)); ind = fliplr(ind); i = 1; while (norm([X(ind(1:i)) zeros(1,100-i)])/norm(X)<.99) i = i + 1; end i = 3