Relations between DCTVII and DSTVII
Contents
- Definitions
- DCTVII matrix definition
- DCTVII in terms of Tschebyshev polynomials
- DSTVII matrix definition
- DSTVII in terms of Tschebyshev polynomials
- Finding relations
- Check expression of DCTVII through DSTVII
- Check expression of DSTVII through DCTVII
- Check computation of DCTVII transform
- Check computation of DSTVII 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=9; 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.9830 0.9325 0.8502 0.7390 0.6026 0.4457 1.0000 0.8502 0.4457 -0.0923 -0.6026 -0.9325 -0.9830 1.0000 0.6026 -0.2737 -0.9325 -0.8502 -0.0923 0.7390 1.0000 0.2737 -0.8502 -0.7390 0.4457 0.9830 0.0923 1.0000 -0.0923 -0.9830 0.2737 0.9325 -0.4457 -0.8502 1.0000 -0.4457 -0.6026 0.9830 -0.2737 -0.7390 0.9325 1.0000 -0.7390 0.0923 0.6026 -0.9830 0.8502 -0.2737 1.0000 -0.9325 0.7390 -0.4457 0.0923 0.2737 -0.6026 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Columns 8 through 9 0.2737 0.0923 -0.7390 -0.2737 0.9830 0.4457 -0.9325 -0.6026 0.6026 0.7390 -0.0923 -0.8502 -0.4457 0.9325 0.8502 -0.9830 -1.0000 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.9830 0.9325 0.8502 0.7390 0.6026 0.4457 1.0000 0.8502 0.4457 -0.0923 -0.6026 -0.9325 -0.9830 1.0000 0.6026 -0.2737 -0.9325 -0.8502 -0.0923 0.7390 1.0000 0.2737 -0.8502 -0.7390 0.4457 0.9830 0.0923 1.0000 -0.0923 -0.9830 0.2737 0.9325 -0.4457 -0.8502 1.0000 -0.4457 -0.6026 0.9830 -0.2737 -0.7390 0.9325 1.0000 -0.7390 0.0923 0.6026 -0.9830 0.8502 -0.2737 1.0000 -0.9325 0.7390 -0.4457 0.0923 0.2737 -0.6026 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Columns 8 through 9 0.2737 0.0923 -0.7390 -0.2737 0.9830 0.4457 -0.9325 -0.6026 0.6026 0.7390 -0.0923 -0.8502 -0.4457 0.9325 0.8502 -0.9830 -1.0000 1.0000 ans = 2.5778e-13
DSTVII matrix definition
N2=8; N=N2;
k=0:N2-1; l=0:N2-1;
DST7=sin(pi/(N+1/2)*(k+1/2)'*(l+1)) % display DCTV matrix
DST7 = Columns 1 through 7 0.1837 0.3612 0.5264 0.6737 0.7980 0.8952 0.9618 0.5264 0.8952 0.9957 0.7980 0.3612 -0.1837 -0.6737 0.7980 0.9618 0.3612 -0.5264 -0.9957 -0.6737 0.1837 0.9618 0.5264 -0.6737 -0.8952 0.1837 0.9957 0.3612 0.9957 -0.1837 -0.9618 0.3612 0.8952 -0.5264 -0.7980 0.8952 -0.7980 -0.1837 0.9618 -0.6737 -0.3612 0.9957 0.6737 -0.9957 0.7980 -0.1837 -0.5264 0.9618 -0.8952 0.3612 -0.6737 0.8952 -0.9957 0.9618 -0.7980 0.5264 Column 8 0.9957 -0.9618 0.8952 -0.7980 0.6737 -0.5264 0.3612 -0.1837
DSTVII in terms of Tschebyshev polynomials
The DSTVII matrix can be expressed in terms of Tschebyshev polynomials [1]
where
are roots of polynomial
beta=sort([roots(TschebyshevV(N))],'descend'); DST7t=zeros(N); for l=0:N2-1, DST7t(:,l+1)=polyval(TschebyshevU(l),beta)'; end Db7=diag(sin(pi/(N+1/2)*(k+1/2))); DST7t=Db7*DST7t % display DCTV matrix % compare DST7 and DST7t matrices (show that both definitions above are equivalent) max(max(abs(DST7-DST7t)))
DST7t = Columns 1 through 7 0.1837 0.3612 0.5264 0.6737 0.7980 0.8952 0.9618 0.5264 0.8952 0.9957 0.7980 0.3612 -0.1837 -0.6737 0.7980 0.9618 0.3612 -0.5264 -0.9957 -0.6737 0.1837 0.9618 0.5264 -0.6737 -0.8952 0.1837 0.9957 0.3612 0.9957 -0.1837 -0.9618 0.3612 0.8952 -0.5264 -0.7980 0.8952 -0.7980 -0.1837 0.9618 -0.6737 -0.3612 0.9957 0.6737 -0.9957 0.7980 -0.1837 -0.5264 0.9618 -0.8952 0.3612 -0.6737 0.8952 -0.9957 0.9618 -0.7980 0.5264 Column 8 0.9957 -0.9618 0.8952 -0.7980 0.6737 -0.5264 0.3612 -0.1837 ans = 1.4100e-13
Finding relations
Because there exist relation
and
we can express DCTVII through DSTVII
where
B=toeplitz([0.5 zeros(1,N-1)]',[0.5 0 -0.5 zeros(1,N-length([0.5 0 -0.5]))]); B(1,1)=1; B=[B [0; B(1:end-1,end)]]; B(8,9)=0.5; B=[B; (-1).^(0:size(B,2)-1)];
Check expression of DCTVII through DSTVII
DCT7a=Da7*blkdiag(inv(Db7)*DST7,1)*B
% compare DCT7 and DCT7a matrices (show correctness of representation of DCTVII through DSTVII)
max(max(abs(DCT7-DCT7a)))
DCT7a = Columns 1 through 7 1.0000 0.9830 0.9325 0.8502 0.7390 0.6026 0.4457 1.0000 0.8502 0.4457 -0.0923 -0.6026 -0.9325 -0.9830 1.0000 0.6026 -0.2737 -0.9325 -0.8502 -0.0923 0.7390 1.0000 0.2737 -0.8502 -0.7390 0.4457 0.9830 0.0923 1.0000 -0.0923 -0.9830 0.2737 0.9325 -0.4457 -0.8502 1.0000 -0.4457 -0.6026 0.9830 -0.2737 -0.7390 0.9325 1.0000 -0.7390 0.0923 0.6026 -0.9830 0.8502 -0.2737 1.0000 -0.9325 0.7390 -0.4457 0.0923 0.2737 -0.6026 1.0000 -1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 Columns 8 through 9 0.2737 0.0923 -0.7390 -0.2737 0.9830 0.4457 -0.9325 -0.6026 0.6026 0.7390 -0.0923 -0.8502 -0.4457 0.9325 0.8502 -0.9830 -1.0000 1.0000 ans = 2.3315e-15
Check expression of DSTVII through DCTVII
DST7a=blkdiag(Db7,1)*inv(Da7)*DCT7*inv(B);
DST7a=DST7a(1:end-1,1:end-1)
% compare DST7 and DST7a matrices (show correctness of representation of DSTVII through DCTVII)
max(max(abs(DST7-DST7a)))
DST7a = Columns 1 through 7 0.1837 0.3612 0.5264 0.6737 0.7980 0.8952 0.9618 0.5264 0.8952 0.9957 0.7980 0.3612 -0.1837 -0.6737 0.7980 0.9618 0.3612 -0.5264 -0.9957 -0.6737 0.1837 0.9618 0.5264 -0.6737 -0.8952 0.1837 0.9957 0.3612 0.9957 -0.1837 -0.9618 0.3612 0.8952 -0.5264 -0.7980 0.8952 -0.7980 -0.1837 0.9618 -0.6737 -0.3612 0.9957 0.6737 -0.9957 0.7980 -0.1837 -0.5264 0.9618 -0.8952 0.3612 -0.6737 0.8952 -0.9957 0.9618 -0.7980 0.5264 Column 8 0.9957 -0.9618 0.8952 -0.7980 0.6737 -0.5264 0.3612 -0.1837 ans = 3.4417e-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*blkdiag(inv(Db7)*DST7,1)*B*x; % compute DCTVII using DSTVII transform disp('y1''=');disp(y1');
x'= Columns 1 through 7 -0.8045 0.6966 0.8351 -0.2437 0.2157 -1.1658 -1.1480 Columns 8 through 9 0.1049 0.7223 y'= Columns 1 through 7 -0.5078 1.9929 -0.8850 -2.8326 0.5374 -2.7494 -1.6514 Columns 8 through 9 -0.9564 0.4287 y1'= Columns 1 through 7 -0.5078 1.9929 -0.8850 -2.8326 0.5374 -2.7494 -1.6514 Columns 8 through 9 -0.9564 0.4287
Check computation of DSTVII transform
x=randn(N2,1); disp('x''=');disp(x'); y=DST7*x; % true result disp('y''=');disp(y'); y1=blkdiag(Db7,1)*inv(Da7)*DCT7*inv(B)*[x;0]; % compute DSTVII using DCTVII transform disp('y1''=');disp(y1'); % Reference
x'= Columns 1 through 7 2.5855 -0.6669 0.1873 -0.0825 -1.9330 -0.4390 -1.7947 Column 8 0.8404 y'= Columns 1 through 7 -2.5477 0.6680 4.1759 -0.0279 2.9861 1.9643 5.0760 Column 8 -0.9750 y1'= Columns 1 through 7 -2.5477 0.6680 4.1759 -0.0279 2.9861 1.9643 5.0760 Columns 8 through 9 -0.9750 -0.0000