Search code examples
matlabtransformtrigonometrydctdiscrete

Is there a function in matlab to calculate higher level of DCT's like DCT-III,IV?


I have recently started working with DCT. I have started with DCT-II, and there is dct() & dct2() in MATLAB that helps in the calculated of 1-D and 2-D DCT-II respectively. I wanted to know if there are some other functions that help in the calculations of higher level of DCT, like III or IV.


Solution

  • yes, the dct function has a Type argument that accepts 1 or 2 or 3 or 4 , so you can use it .

    dct(x,n,dim,'Type',3)
    

    Edit: it just hit me that the author is asking for 3 and 4 dimension DCT, not the DCT3 and DCT4 algorithms ... well, there isn't but it's not too hard to implement, a 2D DCT is just doing DCT on 2 dimensions, hence a 3D DCT would look like this

    result = dct(x,n1,1);
    result = dct(result,n2,2);
    result = dct(result,n3,3);