function X=Fseries(x)
%   X=Fseries(x)
%  Returns complex Fourier Series coeffs 
%      X=[X(0), X(1), ... , X(M)] of x(t).
%
%  Assumptions: x(t) is real, T-periodic and
%  x=[x(0),x(ts),...,x((L-1)*ts)], where ts=T/L. 
%  Also, x(t) is bandlimited to  fs/2 Hz,
%  and therefore M <= L/2.
	L=length(x);
	X=(1/L)*fft(x);
	M=floor(L/2);
	if L==2*M
		X=[X(1:M),.5*X(M+1)];
	else
		X=X(1:M+1);
	end
