Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
DCT and DST (+ inverse) in arbitrary dimension

5.0 | 1 rating Rate this file 18 Downloads (last 30 days) File Size: 8.53 KB File ID: #26040 Version: 1.5
image thumbnail

DCT and DST (+ inverse) in arbitrary dimension


Damien Garcia (view profile)


07 Dec 2009 (Updated )

Discrete cosine/sine transforms and their inverses

| Watch this File

File Information

Y = DCTN(X) returns the discrete cosine transform (DCT) of X.

X = IDCTN(Y) returns the inverse discrete cosine transform (IDCT) of Y.

Y = DSTN(X) returns the discrete sine transform (DST) of X.

X = IDSTN(Y) returns the inverse discrete sine transform (IDST) of Y.

X and Y can be N-dimensional.

D = DSTMTX(k) returns the k-by-k DST transform matrix.

Faster DCT2 and IDCT2 are also included in the zip file.

Enter "help dctn", "help dstn", "help idctn", "help idstn" and "help dstmtx" in the Matlab command window for complete information.

RGB = imread('autumn.tif');
I = rgb2gray(RGB);
J = dstn(I);
imshow(log(abs(J)),[]), colormap(jet), colorbar
The commands below set values less than magnitude 10 in the DST matrix to zero, then reconstruct the image using the inverse DST.
J(abs(J)<10) = 0;
K = idstn(J);
figure, imshow(I)
figure, imshow(K,[0 255])



This file inspired Inpaint Over Missing Data In 1 D, 2 D, 3 D,... N D Arrays and Pcg Unwrap 2 D(Ph Nii, Ph File, Mask Nii, Max Iter, Epsi Con, N).

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
09 Dec 2011 G. Sken

G. Sken (view profile)

these function when used in >resize3d< allow faster volume resizing of large volumes with less memory usage

09 Mar 2010 1.2

DCT and IDCT have been added upon request

23 Nov 2011 1.4

Faster DCT2 and IDCT2 are also included

25 Nov 2011 1.5

faster DCT2 and IDCT2 are also included

Contact us