Relations between DCTVI and DSTV
Contents
- Definitions
- DCTVI matrix definition
- DCTVI in terms of Tschebyshev polynomials
- DSTV matrix definition
- DSTV in terms of Tschebyshev polynomials
- Finding relations
- Check expression of DCTVI through DSTV
- Check expression of DSTV through DCTVI
- Check computation of DCTVI transform
- Check computation of DSTV transform
Definitions
Transform matrix is defined for operating on column-vectors y=T*x, where y, x are column-vectors, T is transform matrix
DCTVI matrix definition
N1=9; N=N1;
k=0:N1-1; l=0:N1-1;
DCT6=cos(pi/(N-1/2)*k'*(l+1/2)) % display DCTV matrix
DCT6 = Columns 1 through 7 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.9830 0.8502 0.6026 0.2737 -0.0923 -0.4457 -0.7390 0.9325 0.4457 -0.2737 -0.8502 -0.9830 -0.6026 0.0923 0.8502 -0.0923 -0.9325 -0.7390 0.2737 0.9830 0.6026 0.7390 -0.6026 -0.8502 0.4457 0.9325 -0.2737 -0.9830 0.6026 -0.9325 -0.0923 0.9830 -0.4457 -0.7390 0.8502 0.4457 -0.9830 0.7390 0.0923 -0.8502 0.9325 -0.2737 0.2737 -0.7390 0.9830 -0.9325 0.6026 -0.0923 -0.4457 0.0923 -0.2737 0.4457 -0.6026 0.7390 -0.8502 0.9325 Columns 8 through 9 1.0000 1.0000 -0.9325 -1.0000 0.7390 1.0000 -0.4457 -1.0000 0.0923 1.0000 0.2737 -1.0000 -0.6026 1.0000 0.8502 -1.0000 -0.9830 1.0000
DCTVI in terms of Tschebyshev polynomials
The DCTVI matrix can be expressed in terms of Tschebyshev polynomials [1]
where
are roots of polynomial
alpha=sort([roots(TschebyshevW(N-1)); 1],'descend'); DCT6t=zeros(N1); for l=0:N1-1, DCT6t(:,l+1)=polyval(TschebyshevV(l),alpha)'; end Da6=diag(cos(1/2*pi/(N-1/2)*k)); DCT6t=Da6*DCT6t % display DCTV matrix % compare DCT6 and DCT6t matrices (show that both definitions above are equivalent) max(max(abs(DCT6-DCT6t)))
DCT6t = Columns 1 through 7 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.9830 0.8502 0.6026 0.2737 -0.0923 -0.4457 -0.7390 0.9325 0.4457 -0.2737 -0.8502 -0.9830 -0.6026 0.0923 0.8502 -0.0923 -0.9325 -0.7390 0.2737 0.9830 0.6026 0.7390 -0.6026 -0.8502 0.4457 0.9325 -0.2737 -0.9830 0.6026 -0.9325 -0.0923 0.9830 -0.4457 -0.7390 0.8502 0.4457 -0.9830 0.7390 0.0923 -0.8502 0.9325 -0.2737 0.2737 -0.7390 0.9830 -0.9325 0.6026 -0.0923 -0.4457 0.0923 -0.2737 0.4457 -0.6026 0.7390 -0.8502 0.9325 Columns 8 through 9 1.0000 1.0000 -0.9325 -1.0000 0.7390 1.0000 -0.4457 -1.0000 0.0923 1.0000 0.2737 -1.0000 -0.6026 1.0000 0.8502 -1.0000 -0.9830 1.0000 ans = 1.6165e-13
DSTV matrix definition
N2=8; N=N2;
k=0:N2-1; l=0:N2-1;
DST5=sin(pi/(N+1/2)*(k+1)'*(l+1)) % display DCTV matrix
DST5 = Columns 1 through 7 0.3612 0.6737 0.8952 0.9957 0.9618 0.7980 0.5264 0.6737 0.9957 0.7980 0.1837 -0.5264 -0.9618 -0.8952 0.8952 0.7980 -0.1837 -0.9618 -0.6737 0.3612 0.9957 0.9957 0.1837 -0.9618 -0.3612 0.8952 0.5264 -0.7980 0.9618 -0.5264 -0.6737 0.8952 0.1837 -0.9957 0.3612 0.7980 -0.9618 0.3612 0.5264 -0.9957 0.6737 0.1837 0.5264 -0.8952 0.9957 -0.7980 0.3612 0.1837 -0.6737 0.1837 -0.3612 0.5264 -0.6737 0.7980 -0.8952 0.9618 Column 8 0.1837 -0.3612 0.5264 -0.6737 0.7980 -0.8952 0.9618 -0.9957
DSTV in terms of Tschebyshev polynomials
The DSTV matrix can be expressed in terms of Tschebyshev polynomials [1]
where
are roots of polynomial
beta=sort([roots(TschebyshevW(N))],'descend'); DST5t=zeros(N); for l=0:N2-1, DST5t(:,l+1)=polyval(TschebyshevU(l),beta)'; end Db5=diag(sin(pi/(N+1/2)*(k+1))); DST5t=Db5*DST5t % display DCTV matrix % compare DST5 and DST5t matrices (show that both definitions above are equivalent) max(max(abs(DST5-DST5t)))
DST5t = Columns 1 through 7 0.3612 0.6737 0.8952 0.9957 0.9618 0.7980 0.5264 0.6737 0.9957 0.7980 0.1837 -0.5264 -0.9618 -0.8952 0.8952 0.7980 -0.1837 -0.9618 -0.6737 0.3612 0.9957 0.9957 0.1837 -0.9618 -0.3612 0.8952 0.5264 -0.7980 0.9618 -0.5264 -0.6737 0.8952 0.1837 -0.9957 0.3612 0.7980 -0.9618 0.3612 0.5264 -0.9957 0.6737 0.1837 0.5264 -0.8952 0.9957 -0.7980 0.3612 0.1837 -0.6737 0.1837 -0.3612 0.5264 -0.6737 0.7980 -0.8952 0.9618 Column 8 0.1837 -0.3612 0.5264 -0.6737 0.7980 -0.8952 0.9618 -0.9957 ans = 1.4100e-13
Finding relations
Because there exist relation
and
we can express DCTVI through DSTV
where
B=toeplitz([1 zeros(1,N-1)]',[1 -1 zeros(1,N-length([1 -1]))]); B=[B [0; B(1:end-1,end)]]; B(8,9)=-2; B=[ones(1,size(B,2)); B];
Check expression of DCTVI through DSTV
DCT6a=Da6*blkdiag(1,inv(Db5)*DST5)*B
% compare DCT6 and DCT6a matrices (show correctness of representation of DCTVI through DSTV)
max(max(abs(DCT6-DCT6a)))
DCT6a = Columns 1 through 7 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.9830 0.8502 0.6026 0.2737 -0.0923 -0.4457 -0.7390 0.9325 0.4457 -0.2737 -0.8502 -0.9830 -0.6026 0.0923 0.8502 -0.0923 -0.9325 -0.7390 0.2737 0.9830 0.6026 0.7390 -0.6026 -0.8502 0.4457 0.9325 -0.2737 -0.9830 0.6026 -0.9325 -0.0923 0.9830 -0.4457 -0.7390 0.8502 0.4457 -0.9830 0.7390 0.0923 -0.8502 0.9325 -0.2737 0.2737 -0.7390 0.9830 -0.9325 0.6026 -0.0923 -0.4457 0.0923 -0.2737 0.4457 -0.6026 0.7390 -0.8502 0.9325 Columns 8 through 9 1.0000 1.0000 -0.9325 -1.0000 0.7390 1.0000 -0.4457 -1.0000 0.0923 1.0000 0.2737 -1.0000 -0.6026 1.0000 0.8502 -1.0000 -0.9830 1.0000 ans = 1.7208e-15
Check expression of DSTV through DCTVI
DST5a=blkdiag(1,Db5)*inv(Da6)*DCT6*inv(B);
DST5a=DST5a(2:end,2:end)
% compare DST5 and DST5a matrices (show correctness of representation of DSTV through DCTVI)
max(max(abs(DST5-DST5a)))
DST5a = Columns 1 through 7 0.3612 0.6737 0.8952 0.9957 0.9618 0.7980 0.5264 0.6737 0.9957 0.7980 0.1837 -0.5264 -0.9618 -0.8952 0.8952 0.7980 -0.1837 -0.9618 -0.6737 0.3612 0.9957 0.9957 0.1837 -0.9618 -0.3612 0.8952 0.5264 -0.7980 0.9618 -0.5264 -0.6737 0.8952 0.1837 -0.9957 0.3612 0.7980 -0.9618 0.3612 0.5264 -0.9957 0.6737 0.1837 0.5264 -0.8952 0.9957 -0.7980 0.3612 0.1837 -0.6737 0.1837 -0.3612 0.5264 -0.6737 0.7980 -0.8952 0.9618 Column 8 0.1837 -0.3612 0.5264 -0.6737 0.7980 -0.8952 0.9618 -0.9957 ans = 1.9984e-15
Check computation of DCTVI transform
x=randn(N1,1); disp('x''=');disp(x'); y=DCT6*x; % true result disp('y''=');disp(y'); y1=Da6*blkdiag(1,inv(Db5)*DST5)*B*x; % compute DCTVI using DSTV transform disp('y1''=');disp(y1');
x'= Columns 1 through 7 -0.8637 0.0774 -1.2141 -1.1135 -0.0068 1.5326 -0.7697 Columns 8 through 9 0.3714 -0.2256 y'= Columns 1 through 7 -2.2120 -2.0540 -0.4309 2.3145 -0.0095 -3.0319 -0.2648 Columns 8 through 9 0.2902 -2.5875 y1'= Columns 1 through 7 -2.2120 -2.0540 -0.4309 2.3145 -0.0095 -3.0319 -0.2648 Columns 8 through 9 0.2902 -2.5875
Check computation of DSTV transform
x=randn(N2,1); disp('x''=');disp(x'); y=DST5*x; % true result disp('y''=');disp(y'); y1=blkdiag(1,Db5)*inv(Da6)*DCT6*inv(B)*[0;x]; % compute DSTV using DCTVI transform disp('y1''=');disp(y1'); % Reference
x'= Columns 1 through 7 1.1174 -1.0891 0.0326 0.5525 1.1006 1.5442 0.0859 Column 8 -1.4916 y'= Columns 1 through 7 2.3113 -1.8069 -1.2896 3.4160 -0.3740 3.5372 0.3434 Column 8 1.3075 y1'= Columns 1 through 7 0.0000 2.3113 -1.8069 -1.2896 3.4160 -0.3740 3.5372 Columns 8 through 9 0.3434 1.3075