function [cf,sn] = utGetComplexFrequencies(w,Ts)
% Turns real or complex frequency vector W into vector of complex 
% frequencies CF (s or z values). Also returns equivalent continuous-time
% normalized frequencies SN (s in continuous-time, log(z) in discrete time).

%   Copyright 1986-2011 The MathWorks, Inc.
if isreal(w)
   if Ts==0
      % Don't use 1i*w because this maps w=Inf to NaN+1i*Inf
      sn = complex(0,w);
      cf = sn;
   else
      sn = complex(0,w*abs(Ts));
      cf = exp(sn);  % z = exp(j*w*Ts)
   end
else
   % W contains complex frequencies (old syntax)
   cf = w;
   if Ts==0
      sn = cf;
   else
      sn = log(cf);
   end
end
