%% computes Fourier coefficients for a sampled signal
%% the script cossinmat is needed, (cossinmat2 or cossinmat3 can be used) 
N = 128;
t = (0:1:(N-1))'/N; 
% note the use of a ' to create a column vector  

y = 2*cos(5*2*pi*t)-0.5*sin(24*2*pi*t);
A = cossinmat(N);

x = A\y;

figure(1)
plot(y)
axis tight

disp('Press a key');
pause

figure(2)
plot(x)
axis tight
