%FUNCTION [freq,trans] = Time2Freq(time,signal)
%********************************************

function [freq,trans]=Time2Freq(time,signal);
[tm,tn]=size(time);
if tm < 4,
   error('time data must be in column format')
end;
[sm,sn]=size(signal);
if sm < 4,
   error('signal data must be in column format')
end;
if ((tm ~= sm) | (tn ~= sn)),
   error('time and signal data dimensions must match')
end;

%Calculate Transform and retain only the positive half.
N=sm;
transform = fft(signal);
dt=time(2)-time(1);
T=max(time)-min(time);
df=1/T;
HN = ceil(N/2) ;
freq = (0:(HN-1))'*df ;
trans = transform(1:HN) ;
[m,n]=size(freq);
trans=(1/m)*trans;
