Skip to content

Instantly share code, notes, and snippets.

@shane5ul
Created June 9, 2014 19:41
Show Gist options
  • Save shane5ul/1585478f346ef089ee36 to your computer and use it in GitHub Desktop.
Save shane5ul/1585478f346ef089ee36 to your computer and use it in GitHub Desktop.
Discete Cosine Series Tutorial: Snippet 1
n = 15; % number of collocation points is (n+1)
nmodes = 5; % number of modes of the DCS
xi = [0:n]'/(n+1); % collocation points for DCS
V = zeros(n+1, nmodes);
%
% V: stack the nmodes DCS basis functions columnwise
%
for j = 1:nmodes
V(:,j) = cos(2*pi*(j-1)*xi);
endfor
(2/n+1)*V' * V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment