function m = mag(X)

% magnitude version of output of fft (of real signal)
Y = X(1:(length(X)/2));
m = (1/length(Y))*sqrt(real(Y).^2 + imag(Y).^2);
return
