SignalProcessing
DCT
compute forward discrete cosine transform
InverseDCT
compute inverse discrete cosine transform
Calling Sequence
Parameters
Options
Description
Thread Safety
Examples
Compatibility
DCT(A)
InverseDCT(A)
A
-
Array of real numeric values; the signal
container : Array, predefined Array for holding results
inplace : truefalse, specifies that output should overwrite input
The DCT(A) command computes the discrete cosine transform (DCT) of the Array A and returns the result in an Array with datatype float[8].
The InverseDCT(A) command computes the inverse discrete cosine transform of the Array A and returns the result in an Array with datatype float[8].
Before the code performing the computation runs, A is converted to datatype float[8] if it does not have that datatype already. For this reason, it is most efficient if A has this datatype beforehand.
The discrete cosine transform B of a sample of N elements with initial index 1 is defined by the formula
Bk=Ck∑i=1NAicos2i−1πk−12N
where Ck is given by
Ck=1Nk=12Notherwise
Samples may be of arbitrary length, but when the length is a power of 2, a faster algorithm is used,
If the container=C option is provided, then the results are put into C and C is returned. With this option, no additional memory is allocated to store the result. The container must be an Array having datatype float[8] and size equal to those of A.
If the inplace or inplace=true option is provided, then A is overwritten with the results. In this case, the container option is ignored. Furthermore, A must have datatype float[8].
The SignalProcessing[DCT] and SignalProcessing[InverseDCT] commands are thread-safe as of Maple 17.
For more information on thread safety, see index/threadsafe.
withSignalProcessing:
withplots:
N≔10:
A≔GenerateToneN,1,0.1,0+GenerateToneN,3,0.4,0.2:
B≔DCTA
B≔−5.61733354972272×10−161.840815074937472.126627020880101.07340522632521−5.99869680619447×10−161.86744934354457−1.23392200523572×10−154.532017760897823.29911475027503−2.45478072804124
displaylistplotA,title=Signal,listplotB,title=Cosine Transform
C≔InverseDCTB
C≔3.94019973352373−1.919979265074891.784425963812390.0327174052186558−2.837363837479881.94019973352373−3.538013253824791.166391975062490.650751393968551−1.21932984872999
mapfnormal,A−C
0.−0.0.0.0.0.−0.−0.0.0.
A≔GenerateJaehne10,3
A≔0.0.4693033951206931.763355756877422.963065021785411.76335575687742−2.12132034355964−1.763355756877422.96306502178541−1.763355756877420.469303395120694
C≔Array1..10,datatype=float8:
DCTA,container=C
1.500000000000001.53435101970163−0.303665947951025−2.52783090094747−2.060398975627682.248013729607341.27812042982672−2.678116209588312.16323992827129−1.03295888501124
C
InverseDCTC,inplace
−1.38777878078145×10−160.4693033951206931.763355756877422.963065021785411.76335575687742−2.12132034355964−1.763355756877422.96306502178541−1.763355756877420.469303395120694
0.−0.−0.0.0.0.0.0.0.0.
The SignalProcessing[DCT] and SignalProcessing[InverseDCT] commands were introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
See Also
SignalProcessing[DFT]
SignalProcessing[DWT]
SignalProcessing[FFT]
Download Help Document