Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@math/fq2ri.m @ 36:5eb86f6881ef database-connection-manager
Remove commented-out code
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% FQ2RI Convert frequency/Q pole/zero representation into real % and imaginary conjugate pairs. % % [G,ri]= fq2ri(f0, Q) % % M Hewitson 26-01-07 % % $Id: fq2ri.m,v 1.3 2008/10/24 09:40:19 hewitson Exp $ % function [G,ri]= fq2ri(f0, Q) if(nargin==0) disp('usage: ri = fq2ri2(f0, Q)') return elseif(nargin==1 || nargin==2 && isnan(Q)) ri = -((2*pi*f0)); elseif(nargin==2 && Q>=0) if Q < 0.5 disp('!!! Q < 0.5! Splitting to two real poles;') a = 2*pi*f0/(2*Q)*(1+sqrt(1-4*Q^2)); b = 2*pi*f0/(2*Q)*(1-sqrt(1-4*Q^2)); ri = [a b]; elseif Q == 0.5 disp('!!! Q = 0.5! Returning one real pole;') w0 = 2*pi*f0; re = w0/(2*Q); ri = [re]; else w0 = 2*pi*f0; re = w0/(2*Q); im = w0*sqrt(1-1/(4*Q^2)); tri = complex(re,im); ri = [tri; conj(tri)]; end end end % END