% calculate a discrete fourier tranform and use the sample time to create
% a frequency axis. Also, correct the amplitude for the sample time.
% [Y,f] = myfour(y,Dt,N); if y is 2D, then the fourier transform of all
% !columns! are calculated.
if nargin < 3; N = length(y); end
if length(Dt)> 1; Dt = Dt(2)-Dt(1); end; % if complete time axis is given, assume evenly spaced samples
[a,b] = size(y);
if a == 1 || b == 1
Y = fftshift(fft(y,N));
Y = fftshift(fft(y,N),1);
Y = Y*Dt; % to get the right amplitude
Df = 1/(Dt*N);
f = ((0:N-1)-N/2)*Df;