diff m-toolbox/classes/@ao/fq2fac.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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@ao/fq2fac.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,30 @@
+% FQ2FAC is a private function and is called by ngconv.m which can be found in the
+% folder 'noisegenerator'.
+% It calculates polynomial coefficients from given poles and Zeros.
+%
+% Inputs (from ngconv.m):
+%        - f : frequency of apole or zero
+%        - q : quality factor of a pole or zero
+%
+% Outputs:
+%        - polzero: a vector of resulting polynomial coefficients
+%
+% A Monsky 24-07-07
+%
+% $Id: fq2fac.m,v 1.2 2008/08/01 13:19:42 ingo Exp $
+%
+
+function polzero = fq2fac(f,q)
+
+  n = length(f);
+  polzero = zeros(n,3);
+  for i = 1:n
+    if isnan(q(i))
+      polzero(i,1:2) = [1 1/(2*pi*f(i))];
+    else
+      polzero(i,1:3) = [1 1/(2*pi*f(i)*q(i)) 1/((2*pi*f(i))*(2*pi*f(i)))];
+    end
+  end
+
+end
+