commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11589 - in gnuradio/branches/developers/n4hy/pfb_iir2


From: n4hy
Subject: [Commit-gnuradio] r11589 - in gnuradio/branches/developers/n4hy/pfb_iir2: gnuradio-core/src/lib/general gnuradio-examples/python/apps/filter_design_tool
Date: Thu, 13 Aug 2009 14:16:03 -0600 (MDT)

Author: n4hy
Date: 2009-08-13 14:16:03 -0600 (Thu, 13 Aug 2009)
New Revision: 11589

Modified:
   
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
   
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
   
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
   
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-examples/python/apps/filter_design_tool/iirdestest.py
Log:
transfer function to zeros, poles, gain added, but not completely tested.  Uses 
gsl polynomial solver

Modified: 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
       2009-08-12 22:52:44 UTC (rev 11588)
+++ 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
       2009-08-13 20:16:03 UTC (rev 11589)
@@ -301,33 +301,38 @@
 {
   int size = tf.a.size();
   gsl_poly_complex_workspace *w;
-  double *a,*b;
-  gr_complexd *z;
+  double *a,*b,*z;
   gr_iirdes::zpk rtn;
-  gr_complexd *zero, *pole;
+
   
   if (size < 2) throw std::invalid_argument
                  ("transfer function to pole, zero, gain calculation requires 
order 2 or greater");
-
+  rtn.order = size;
+  rtn.z = new gr_complexd(size);
+  rtn.p = new gr_complexd(size);
   w = gsl_poly_complex_workspace_alloc(size);
-  z = new gr_complexd(size);
+  z = new double(size);
   a = new double(size);
   b = new double(size);
+
   for (int i=0;i<size;i++) {
     a[i]=tf.a[i];
     b[i]=tf.b[i];
+    z[2*i]=0;
+    z[2*i+1]=0;
   }
-
+  
   // compute zeros
-  gsl_poly_complex_solve (&a[0], size, w, (double *)z);
+  gsl_poly_complex_solve (&a[0], size, w, z);
   // store them in the zeros in the zpk array
   for (int i=0;i<size;i++)
-    zero[i]=z[i];
+    rtn.z[i] = gr_complexd(z[2*i],z[2*i+1]);
 
   // compute poles
-  gsl_poly_complex_solve (&b[0], size, w, (double *)z);
+  gsl_poly_complex_solve (&b[0], size, w, z);
   for (int i=0;i<size;i++)
-    pole[i]=z[i];
+    rtn.p[i] = gr_complexd(z[2*i],z[2*i+1]);
+
   rtn.k = tf.b[0]/tf.a[0];
 
   return rtn;

Modified: 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
        2009-08-12 22:52:44 UTC (rev 11588)
+++ 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
        2009-08-13 20:16:03 UTC (rev 11589)
@@ -60,14 +60,15 @@
   } transfer_function;
 
   typedef struct _zpk {
-    std::vector<gr_complexd> *z;
-    std::vector<gr_complexd> *p;
+    gr_complexd *z;
+    gr_complexd *p;
+    int order;
     double k;
   } zpk;
 
   typedef struct _sos {
-    std::vector<double> Num;
-    std::vector<double> Den;
+    std::vector<double> num;
+    std::vector<double> den;
     double g;
   } sos;
 

Modified: 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
        2009-08-12 22:52:44 UTC (rev 11588)
+++ 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
        2009-08-13 20:16:03 UTC (rev 11589)
@@ -50,14 +50,14 @@
   } transfer_function;
 
   typedef struct _zpk {
-    std::vector<double> *z;
-    std::vector<double> *p;
+    std::vector<gr_complexd> z;
+    std::vector<gr_complexd> p;
     double               k;
   } zpk;
 
   typedef struct _sos {
-    std::vector<double> Num;
-    std::vector<double> Den;
+    std::vector<double> num;
+    std::vector<double> den;
     double g;
   } sos;
 

Modified: 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-examples/python/apps/filter_design_tool/iirdestest.py
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-examples/python/apps/filter_design_tool/iirdestest.py
   2009-08-12 22:52:44 UTC (rev 11588)
+++ 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-examples/python/apps/filter_design_tool/iirdestest.py
   2009-08-13 20:16:03 UTC (rev 11589)
@@ -29,3 +29,5 @@
                               30)
 print numbers
 
+
+





reply via email to

[Prev in Thread] Current Thread [Next in Thread]