dct_ii.sci

来自「小波分解源代码」· SCI 代码 · 共 34 行

SCI
34
字号
function c = dct_ii(x)
// dct_ii -- Discrete Cosine Transform of Type II
//  Usage
//    c = dct_ii(x)
//  Inputs
//    x     signal of dyadic length
//  Outputs
//    c     discrete cosine transform, type II, of x
//
//  Description
//    The form c = dct_ii(x) computes c defined by
//        c_m = sqrt(2/N) * sum_n x(n) k_m cos( pi * m (2n+1) / 2N )
//    where 
//        0 <= m,n <= N-1,  N = length(x) = length(c)
//    and k_m = [ 1           if 1 <= m <= N-1
//              [ 1/sqrt(2)   if m = 0 
//
//   The dct_ii is inverted by the dct_iii.
//
//  See Also
//    DetailMeyerCoeff, FineMeyerCoeff
//
//  Copyright Aldo I Maalouf

	n   = length2(x);
	rx  = matrix([ zeros(1,n) ; x ],1,2*n);
	y   = [rx zeros(1,2*n)];
	w   = real(mtlb_fft(y));
	c   = sqrt(2/n)*w(1:n);
	c(1)= c(1)/sqrt(2);

endfunction
    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?