function a = f_axis(X,T,axis_type)
%
%  a = f_axis(X,T,axis_type)
%
%  generate a frequency axis for FFT plots
%
%  X = FFT data (1-ï ¯®«®¢¨­  à¥§ã«ìâ â  FFT())
%  T = sampling period
%  axis_type = type of axis to create:
%              1 = Digital Rad/s [0,pi],  2 = Analog Radians/s
%              3 = Analog Hertz           4 = Normalized frequency [0,1]
%
%  Defaults if not specified:  axis_type = 3, T = 1
%
%  to plot FFT data:  plot(a,X)

%  Initial -> faxis()
%  Modified -> 22.02.96 Khomutov S.Yu.

if nargin == 2,
                  axis_type = 3.0;
elseif nargin == 1,
                  axis_type = 3.0;
                  T = 1.0;
end
N = length(X);
a = (0:N-1)/(2*(N-1));
if     axis_type == 3,
                       a = a/T;
elseif axis_type == 2,
                       a = a * (2*pi/T);
elseif axis_type == 4,
                       a = 2 * a;
else
                       a = a * (2*pi);
end
a = a';
