%% Example 6.3
% Calculation of the discrete Sine and Cosine transform


%% Define the function
f = @(x) (x./pi).^2;


%% Sine and Cosine transform
N = 16;
X = [0:pi/N:pi];
k = [0:N];
cos_coeff = dct1(f(X)');
sin_coeff = [dst1(f(X)')];


%% Generates the plots
plot(k,abs(cos_coeff),'k-^','MarkerFaceColor','k','LineWidth',2);
hold on;
plot(k,abs(sin_coeff),'k:o','MarkerFaceColor','k','LineWidth',2);
grid on;
axis([-0.5 16.5 -0.1 0.5]);
legend('Cosine Transform','Sine Transform');