Example 6.9

Calculation of the discrete Chebyshev coefficients

Contents

Initialization

close all;
clear N j X u U


N = 8;
j = [N:-1:0]';
X = cos(j*pi/N);

Coefficients of x^4

dct1(X.^4)
ans =

   0.375000000000000
  -0.000000000000000
   0.500000000000000
   0.000000000000000
   0.125000000000000
   0.000000000000000
                   0
  -0.000000000000000
                   0

u(x) = 4*(x�-x^4)*e(-x�/2)

u = @(x) 4*(x.^2).*(1 - x.^2).*exp(-x/2);
U = u(X);

plot([0:N],abs(dct1(U)),'k-o','LineWidth',2);
xlabel('n'); ylabel('|a_n|');
grid on;