comparison m-toolbox/classes/+utils/@math/fq2ri.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % FQ2RI Convert frequency/Q pole/zero representation into real
2 % and imaginary conjugate pairs.
3 %
4 % [G,ri]= fq2ri(f0, Q)
5 %
6 % M Hewitson 26-01-07
7 %
8 % $Id: fq2ri.m,v 1.3 2008/10/24 09:40:19 hewitson Exp $
9 %
10 function [G,ri]= fq2ri(f0, Q)
11
12 if(nargin==0)
13 disp('usage: ri = fq2ri2(f0, Q)')
14 return
15 elseif(nargin==1 || nargin==2 && isnan(Q))
16 ri = -((2*pi*f0));
17 elseif(nargin==2 && Q>=0)
18 if Q < 0.5
19 disp('!!! Q < 0.5! Splitting to two real poles;')
20 a = 2*pi*f0/(2*Q)*(1+sqrt(1-4*Q^2));
21 b = 2*pi*f0/(2*Q)*(1-sqrt(1-4*Q^2));
22 ri = [a b];
23 elseif Q == 0.5
24 disp('!!! Q = 0.5! Returning one real pole;')
25 w0 = 2*pi*f0;
26 re = w0/(2*Q);
27 ri = [re];
28 else
29 w0 = 2*pi*f0;
30 re = w0/(2*Q);
31 im = w0*sqrt(1-1/(4*Q^2));
32 tri = complex(re,im);
33 ri = [tri; conj(tri)];
34 end
35 end
36
37 end
38 % END