Mercurial > hg > ltpda
comparison m-toolbox/classes/@pz/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 | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: FQ2RI Convert frequency/Q pole/zero representation into: | |
5 % -Q=Nan: real pole/zero [output: ri] | |
6 % -Q>0.5 real and imaginary conjugate pairs [ri conj(ri)] | |
7 % -Q=0.5 two equal real poles [ri ri] | |
8 % -Q<0.5 two real poles [ri ri] | |
9 % | |
10 % CALL: ri= fq2ri(f0, Q) | |
11 % | |
12 % VERSION: $Id: fq2ri.m,v 1.10 2011/02/18 16:48:54 ingo Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 function ri= fq2ri(f0, Q) | |
17 | |
18 if(nargin==0) | |
19 disp('usage: ri = fq2ri2(f0, Q)') | |
20 return | |
21 elseif(nargin==1 || nargin==2 && isnan(Q)) | |
22 ri = -((2*pi*f0)); | |
23 elseif(nargin==2 && Q>=0) | |
24 if Q < 0.5 | |
25 disp('!!! Q < 0.5! Splitting to two real poles/zeros;') | |
26 a = 2*pi*f0/(2*Q)*(1+sqrt(1-4*Q^2)); | |
27 b = 2*pi*f0/(2*Q)*(1-sqrt(1-4*Q^2)); | |
28 ri = [a b]; | |
29 elseif Q == 0.5 | |
30 disp('!!! Q = 0.5! Returning two equal real poles/zeros;') | |
31 w0 = 2*pi*f0; | |
32 re = w0/(2*Q); | |
33 ri = [re re]; | |
34 else | |
35 w0 = 2*pi*f0; | |
36 re = -w0/(2*Q); | |
37 im = w0*sqrt(1-1/(4*Q^2)); | |
38 tri = complex(re,im); | |
39 ri = [tri; conj(tri)]; | |
40 end | |
41 | |
42 end | |
43 |