# Relations between DSTVI and DSTV

## Definitions

Transform matrix is defined for operating on column-vectors y=T*x, where y, x are column-vectors, T is transform matrix

## DSTVI matrix definition

N1=8; N=N1;
k=0:N1-1;  l=0:N1-1;
DST6=sin(pi/(N+1/2)*(k+1)'*(l+1/2))       % display DCTV matrix

DST6 =
Columns 1 through 7
0.1837    0.5264    0.7980    0.9618    0.9957    0.8952    0.6737
0.3612    0.8952    0.9618    0.5264   -0.1837   -0.7980   -0.9957
0.5264    0.9957    0.3612   -0.6737   -0.9618   -0.1837    0.7980
0.6737    0.7980   -0.5264   -0.8952    0.3612    0.9618   -0.1837
0.7980    0.3612   -0.9957    0.1837    0.8952   -0.6737   -0.5264
0.8952   -0.1837   -0.6737    0.9957   -0.5264   -0.3612    0.9618
0.9618   -0.6737    0.1837    0.3612   -0.7980    0.9957   -0.8952
0.9957   -0.9618    0.8952   -0.7980    0.6737   -0.5264    0.3612
Column 8
0.3612
-0.6737
0.8952
-0.9957
0.9618
-0.7980
0.5264
-0.1837


## DSTVI in terms of Tschebyshev polynomials

The DSTVI matrix can be expressed in terms of Tschebyshev polynomials [1]

where

are roots of polynomial

alpha=sort([roots(TschebyshevW(N))],'descend');
DST6t=zeros(N1);
for l=0:N1-1,
DST6t(:,l+1)=polyval(TschebyshevW(l),alpha)';
end
Da6=diag(sin(1/2*pi/(N+1/2)*(k+1)));
DST6t=Da6*DST6t                    % display DCTV matrix

% compare DST6 and DST6t matrices (show that both definitions above are equivalent)
max(max(abs(DST6-DST6t)))

DST6t =
Columns 1 through 7
0.1837    0.5264    0.7980    0.9618    0.9957    0.8952    0.6737
0.3612    0.8952    0.9618    0.5264   -0.1837   -0.7980   -0.9957
0.5264    0.9957    0.3612   -0.6737   -0.9618   -0.1837    0.7980
0.6737    0.7980   -0.5264   -0.8952    0.3612    0.9618   -0.1837
0.7980    0.3612   -0.9957    0.1837    0.8952   -0.6737   -0.5264
0.8952   -0.1837   -0.6737    0.9957   -0.5264   -0.3612    0.9618
0.9618   -0.6737    0.1837    0.3612   -0.7980    0.9957   -0.8952
0.9957   -0.9618    0.8952   -0.7980    0.6737   -0.5264    0.3612
Column 8
0.3612
-0.6737
0.8952
-0.9957
0.9618
-0.7980
0.5264
-0.1837
ans =
2.3470e-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 DSTVI through DSTV

where

B=toeplitz([1 zeros(1,N-1)]',[1  1 zeros(1,N-length([1  1]))]);


## Check expression of DSTVI through DSTV

DST6a=Da6*inv(Db5)*DST5*B
% compare DST6 and DST6a matrices (show correctness of representation of DSTVI through DSTV)
max(max(abs(DST6-DST6a)))

DST6a =
Columns 1 through 7
0.1837    0.5264    0.7980    0.9618    0.9957    0.8952    0.6737
0.3612    0.8952    0.9618    0.5264   -0.1837   -0.7980   -0.9957
0.5264    0.9957    0.3612   -0.6737   -0.9618   -0.1837    0.7980
0.6737    0.7980   -0.5264   -0.8952    0.3612    0.9618   -0.1837
0.7980    0.3612   -0.9957    0.1837    0.8952   -0.6737   -0.5264
0.8952   -0.1837   -0.6737    0.9957   -0.5264   -0.3612    0.9618
0.9618   -0.6737    0.1837    0.3612   -0.7980    0.9957   -0.8952
0.9957   -0.9618    0.8952   -0.7980    0.6737   -0.5264    0.3612
Column 8
0.3612
-0.6737
0.8952
-0.9957
0.9618
-0.7980
0.5264
-0.1837
ans =
3.9968e-15


## Check expression of DSTV through DSTVI

DST5a=Db5*inv(Da6)*DST6*inv(B);
DST5a=DST5a(:,:)
% compare DST5 and DST5a matrices (show correctness of representation of DSTV through DSTVI)
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.2212e-15


## Check computation of DSTVI transform

x=randn(N1,1);
disp('x''=');disp(x');
y=DST6*x;                      % true result
disp('y''=');disp(y');
y1=Da6*inv(Db5)*DST5*B*x;            % compute DSTVI using DSTV transform
disp('y1''=');disp(y1');

x'=
Columns 1 through 7
0.5080    0.2820    0.0335   -1.3337    1.1275    0.3502   -0.2991
Column 8
0.0229
y'=
Columns 1 through 7
0.2287   -0.4382    0.0918    2.5198    1.1817   -1.9736   -0.4483
Column 8
1.7919
y1'=
Columns 1 through 7
0.2287   -0.4382    0.0918    2.5198    1.1817   -1.9736   -0.4483
Column 8
1.7919


## Check computation of DSTV transform

x=randn(N2,1);
disp('x''=');disp(x');
y=DST5*x;                      % true result
disp('y''=');disp(y');
y1=Db5*inv(Da6)*DST6*inv(B)*x;            % compute DSTV using DSTVI transform
disp('y1''=');disp(y1');
% Reference

x'=
Columns 1 through 7
-0.2620   -1.7502   -0.2857   -0.8314   -0.9792   -1.1564   -0.5336
Column 8
-2.0026
y'=
Columns 1 through 7
-4.8708    0.5288   -2.1227    0.2822   -0.7017    2.8241   -0.3251
Column 8
2.7285
y1'=
Columns 1 through 7
-4.8708    0.5288   -2.1227    0.2822   -0.7017    2.8241   -0.3251
Column 8
2.7285