view m-toolbox/classes/+utils/@math/fq2ri2.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line source

% FQ2RI2 Convert frequency/Q pole/zero representation into real
% and imaginary conjugate pairs. Returns [ri conj(ri)]
%
% ri= fq2ri2(f0, Q)
%
% M Hewitson 26-01-07
%
%
% $Id: fq2ri2.m,v 1.2 2008/10/24 06:19:23 hewitson Exp $
%

function ri= fq2ri2(f0, Q)
  
  if(nargin==0)
    disp('usage: ri = fq2ri2(f0, Q)')
    return
  elseif(nargin==1)
    ri = (1/(2*pi*f0));
  elseif(nargin==2)
    if Q <= 0.5
      disp('working on Q < 0.5') %ri =1/(2*pi*f0);
    else
      w0 = 2*pi*f0;
      G = 1/(w0*w0);
      re = -w0/(2*Q);
      im = w0*sqrt(4*Q*Q-1)/(2*Q);
      tri = complex(re,im);
      ri = G.*[tri conj(tri)]';
    end
  end
end
% END