function varargout = fourier_coeffs(n, sigvect, T)
%function [A,B] = fourier_coeffs(n, sigvect, T)

dt=T/(length(sigvect)-1);
t=0:dt:T;
wo=2*pi/T;
cosfunc=cos(n*wo*t).*sigvect;
sinfunc=sin(n*wo*t).*sigvect;
A=trapz(cosfunc)*2/T*dt;
B=trapz(sinfunc)*2/T*dt;

varargout{1}=A;
varargout{2}=B;
varargout{3}=cosfunc;
varargout{4}=sinfunc;
