function X=FTform(x,fs)
%  X=FTform(x,fs)
% Computes an approximation to the Fourier Transform of the signal x.
% sampled at fs samples per second
% x is either 1xL (causal), or 2xL (two-sided). 
% The result will be the complex vector X(j*2*pi*df*[0:N/2-1]) 
% where N is a power of 2, and df=1/T=fs/N
% df is the frequency sampling period.
    [M,L]=size(x);
    N=1024;         % This is the minimum fft size
    while 2*L>N
        N=2*N;      % N must be a power of 2
    end	
    if M==1
        xx=[x,zeros(1,N-L)];
    else	
        xx=[x(1,:),zeros(1,N+1-2*L),fliplr(x(2,[2:L]))];
    end
    X=fft(xx,N);
    X=(1/fs)*X(1:N/2);	