Relations between DCTVII and DSTVIII
Contents
- Definitions
- DCTVII matrix definition
- DCTVII in terms of Tschebyshev polynomials
- DSTVIII matrix definition
- DSTVIII in terms of Tschebyshev polynomials
- Finding relations
- Check expression of DCTVII through DSTVIII
- Check expression of DSTVIII through DCTVII
- Check computation of DCTVII transform
- Check computation of DSTVIII transform
Definitions
Transform matrix is defined for operating on column-vectors y=T*x, where y, x are column-vectors, T is transform matrix
DCTVII matrix definition
N1=8; N=N1;
k=0:N1-1; l=0:N1-1;
DCT7=cos(pi/(N-1/2)*(k+1/2)'*l) % display DCTV matrix
DCT7 = Columns 1 through 7 1.0000 0.9781 0.9135 0.8090 0.6691 0.5000 0.3090 1.0000 0.8090 0.3090 -0.3090 -0.8090 -1.0000 -0.8090 1.0000 0.5000 -0.5000 -1.0000 -0.5000 0.5000 1.0000 1.0000 0.1045 -0.9781 -0.3090 0.9135 0.5000 -0.8090 1.0000 -0.3090 -0.8090 0.8090 0.3090 -1.0000 0.3090 1.0000 -0.6691 -0.1045 0.8090 -0.9781 0.5000 0.3090 1.0000 -0.9135 0.6691 -0.3090 -0.1045 0.5000 -0.8090 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Column 8 0.1045 -0.3090 0.5000 -0.6691 0.8090 -0.9135 0.9781 -1.0000
DCTVII in terms of Tschebyshev polynomials
The DCTVII matrix can be expressed in terms of Tschebyshev polynomials [1]
where
are roots of polynomial
alpha=sort([roots(TschebyshevV(N-1)); -1],'descend'); DCT7t=zeros(N1); for l=0:N1-1, DCT7t(:,l+1)=polyval(TschebyshevT(l),alpha)'; end Da7=diag(cos(0*pi/(N-1/2)*(k+1/2))); DCT7t=Da7*DCT7t % display DCTV matrix % compare DCT7 and DCT7t matrices (show that both definitions above are equivalent) max(max(abs(DCT7-DCT7t)))
DCT7t = Columns 1 through 7 1.0000 0.9781 0.9135 0.8090 0.6691 0.5000 0.3090 1.0000 0.8090 0.3090 -0.3090 -0.8090 -1.0000 -0.8090 1.0000 0.5000 -0.5000 -1.0000 -0.5000 0.5000 1.0000 1.0000 0.1045 -0.9781 -0.3090 0.9135 0.5000 -0.8090 1.0000 -0.3090 -0.8090 0.8090 0.3090 -1.0000 0.3090 1.0000 -0.6691 -0.1045 0.8090 -0.9781 0.5000 0.3090 1.0000 -0.9135 0.6691 -0.3090 -0.1045 0.5000 -0.8090 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Column 8 0.1045 -0.3090 0.5000 -0.6691 0.8090 -0.9135 0.9781 -1.0000 ans = 7.0999e-14
DSTVIII matrix definition
N2=8; N=N2;
k=0:N2-1; l=0:N2-1;
DST8=sin(pi/(N-1/2)*(k+1/2)'*(l+1/2)) % display DCTV matrix
DST8 = Columns 1 through 7 0.1045 0.3090 0.5000 0.6691 0.8090 0.9135 0.9781 0.3090 0.8090 1.0000 0.8090 0.3090 -0.3090 -0.8090 0.5000 1.0000 0.5000 -0.5000 -1.0000 -0.5000 0.5000 0.6691 0.8090 -0.5000 -0.9135 0.3090 0.9781 -0.1045 0.8090 0.3090 -1.0000 0.3090 0.8090 -0.8090 -0.3090 0.9135 -0.3090 -0.5000 0.9781 -0.8090 0.1045 0.6691 0.9781 -0.8090 0.5000 -0.1045 -0.3090 0.6691 -0.9135 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Column 8 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000
DSTVIII in terms of Tschebyshev polynomials
The DSTVIII matrix can be expressed in terms of Tschebyshev polynomials [1]
where
are roots of polynomial
beta=sort([roots(TschebyshevV(N-1)); -1],'descend'); DST8t=zeros(N); for l=0:N2-1, DST8t(:,l+1)=polyval(TschebyshevW(l),beta)'; end Db8=diag(sin(1/2*pi/(N-1/2)*(k+1/2))); DST8t=Db8*DST8t % display DCTV matrix % compare DST8 and DST8t matrices (show that both definitions above are equivalent) max(max(abs(DST8-DST8t)))
DST8t = Columns 1 through 7 0.1045 0.3090 0.5000 0.6691 0.8090 0.9135 0.9781 0.3090 0.8090 1.0000 0.8090 0.3090 -0.3090 -0.8090 0.5000 1.0000 0.5000 -0.5000 -1.0000 -0.5000 0.5000 0.6691 0.8090 -0.5000 -0.9135 0.3090 0.9781 -0.1045 0.8090 0.3090 -1.0000 0.3090 0.8090 -0.8090 -0.3090 0.9135 -0.3090 -0.5000 0.9781 -0.8090 0.1045 0.6691 0.9781 -0.8090 0.5000 -0.1045 -0.3090 0.6691 -0.9135 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Column 8 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 ans = 5.1736e-14
Finding relations
Because there exist relation
and
we can express DCTVII through DSTVIII
where
B=toeplitz([0.5 zeros(1,N-1)]',[0.5 -0.5 zeros(1,N-length([0.5 -0.5]))]); B(1,1)=1;
Check expression of DCTVII through DSTVIII
DCT7a=Da7*inv(Db8)*DST8*B
% compare DCT7 and DCT7a matrices (show correctness of representation of DCTVII through DSTVIII)
max(max(abs(DCT7-DCT7a)))
DCT7a = Columns 1 through 7 1.0000 0.9781 0.9135 0.8090 0.6691 0.5000 0.3090 1.0000 0.8090 0.3090 -0.3090 -0.8090 -1.0000 -0.8090 1.0000 0.5000 -0.5000 -1.0000 -0.5000 0.5000 1.0000 1.0000 0.1045 -0.9781 -0.3090 0.9135 0.5000 -0.8090 1.0000 -0.3090 -0.8090 0.8090 0.3090 -1.0000 0.3090 1.0000 -0.6691 -0.1045 0.8090 -0.9781 0.5000 0.3090 1.0000 -0.9135 0.6691 -0.3090 -0.1045 0.5000 -0.8090 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Column 8 0.1045 -0.3090 0.5000 -0.6691 0.8090 -0.9135 0.9781 -1.0000 ans = 8.8818e-16
Check expression of DSTVIII through DCTVII
DST8a=Db8*inv(Da7)*DCT7*inv(B);
DST8a=DST8a(:,:)
% compare DST8 and DST8a matrices (show correctness of representation of DSTVIII through DCTVII)
max(max(abs(DST8-DST8a)))
DST8a = Columns 1 through 7 0.1045 0.3090 0.5000 0.6691 0.8090 0.9135 0.9781 0.3090 0.8090 1.0000 0.8090 0.3090 -0.3090 -0.8090 0.5000 1.0000 0.5000 -0.5000 -1.0000 -0.5000 0.5000 0.6691 0.8090 -0.5000 -0.9135 0.3090 0.9781 -0.1045 0.8090 0.3090 -1.0000 0.3090 0.8090 -0.8090 -0.3090 0.9135 -0.3090 -0.5000 0.9781 -0.8090 0.1045 0.6691 0.9781 -0.8090 0.5000 -0.1045 -0.3090 0.6691 -0.9135 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Column 8 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 ans = 1.9429e-15
Check computation of DCTVII transform
x=randn(N1,1); disp('x''=');disp(x'); y=DCT7*x; % true result disp('y''=');disp(y'); y1=Da7*inv(Db8)*DST8*B*x; % compute DCTVII using DSTVIII transform disp('y1''=');disp(y1');
x'= Columns 1 through 7 -0.8880 0.1001 -0.5445 0.3035 -0.6003 0.4900 0.7394 Column 8 1.7119 y'= Columns 1 through 7 -0.7913 -2.2006 1.2712 -2.4858 0.7051 -1.1558 -0.0536 Column 8 -3.8990 y1'= Columns 1 through 7 -0.7913 -2.2006 1.2712 -2.4858 0.7051 -1.1558 -0.0536 Column 8 -3.8990
Check computation of DSTVIII transform
x=randn(N2,1); disp('x''=');disp(x'); y=DST8*x; % true result disp('y''=');disp(y'); y1=Db8*inv(Da7)*DCT7*inv(B)*x; % compute DSTVIII using DCTVII transform disp('y1''=');disp(y1'); % Reference
x'= Columns 1 through 7 -0.1941 -2.1384 -0.8396 1.3546 -1.0722 0.9610 0.1240 Column 8 1.4367 y'= Columns 1 through 7 1.3740 -3.6990 -1.2421 -3.5186 0.1939 1.8424 3.2764 Column 8 -3.5957 y1'= Columns 1 through 7 1.3740 -3.6990 -1.2421 -3.5186 0.1939 1.8424 3.2764 Column 8 -3.5957