view m-toolbox/classes/+utils/@math/fq2ri.m @ 18:947e2ff4b1b9
database-connection-manager
Update plist.FROM_REPOSITORY_PLIST and plist.TO_REPOSITORY_PLIST
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05) |
parents |
f0afece42f48 |
children |
|
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