function X = ctft(s, t, w)
% X = CTFT(S, T, W)
% Performs Continuous-Time Fourier Transform on signal s.
%
% Input     Size     Description
% --------------------------------------------
% s      : [1 x N] - the input signal
% t      : [1 x N] - the time vector (our time axis)
% w      : [1 x L] - the frequency vector in rad/sec
%
% Input     Size     Description
% --------------------------------------------
% X      : [1 x L] - the Continuous Time F.T.
% 
% Usage: [s, fs] = wavread('sample.wav');
%        seg = s(500:900);
%        t = 0:1/fs:length(seg)/fs - 1/fs;
%        w = 2*pi*[1:1:fs/2];
%        X = ctft(seg, t, w);
%
% See also: fft, ifft
%
% @ G.P. Kafentzis, CSD, SigProcLab, UoC, 2008.

s = s(:).';
M = exp(-1i*t'*w);       % Fourier Matrix
X = (1/length(t))*s*M;   % Fourier Transform

figure; 
subplot(2,1,1); plot(w, abs(X), 'LineWidth', 2); ylabel('Volts/Hz');
title('Magnitude of CT FT'); xlabel('Frequency in rad/sec'); grid;
subplot(2,1,2); plot(w, angle(X), 'LineWidth', 2); ylabel('Radians');
title('Phase of CT FT'); xlabel('Frequency in rad/sec'); grid;