[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11635 - gnuradio/branches/developers/n4hy/pfb_iir/gnu
From: |
n4hy |
Subject: |
[Commit-gnuradio] r11635 - gnuradio/branches/developers/n4hy/pfb_iir/gnuradio-core/src/lib/general |
Date: |
Wed, 2 Sep 2009 13:38:56 -0600 (MDT) |
Author: n4hy
Date: 2009-09-02 13:38:56 -0600 (Wed, 02 Sep 2009)
New Revision: 11635
Modified:
gnuradio/branches/developers/n4hy/pfb_iir/gnuradio-core/src/lib/general/gr_iirdes.cc
Log:
debugging bandstop sftrans calculation and my poor C++ skills
Modified:
gnuradio/branches/developers/n4hy/pfb_iir/gnuradio-core/src/lib/general/gr_iirdes.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir/gnuradio-core/src/lib/general/gr_iirdes.cc
2009-09-02 18:59:26 UTC (rev 11634)
+++
gnuradio/branches/developers/n4hy/pfb_iir/gnuradio-core/src/lib/general/gr_iirdes.cc
2009-09-02 19:38:56 UTC (rev 11635)
@@ -465,60 +465,65 @@
std::vector<double> W)
{
vector<double> rtn;
- int lz=zero.length()/2;
- int lp=pole.length()/2;
+ int lz=zero.size()/2;
+ int lp=pole.size()/2;
double C=1;
switch (fresp) {
case gr_iirdes::LOWPASS: {
+ return rtn;
}
case gr_iirdes::HIGHPASS: {
+ return rtn;
}
case gr_iirdes::BANDPASS: {
- if (W.length() != 2)
+ if (W.size() != 2)
throw std::invalid_argument("sftrans: BANDSTOP frequency list must be
two long");
- double Fl=W(1), Fh=W(2);
+ //double Fl=W[1], Fh=W[2];
}
case gr_iirdes::BANDSTOP: {
-## ---------------- ------------------------- ------------------------
-## Band Stop zero: b +/- sqrt(b^2-FhFl) pole: b +/- sqrt(b^2-FhFl)
-## S(Fh-Fl) pole: +/- sqrt(-FhFl) zero: +/- sqrt(-FhFl)
-## S -> C -------- gain: -x gain: -1/x
-## S^2+FhFl b=C/x (Fh-Fl)/2 b=C/x (Fh-Fl)/2
-## ---------------- ------------------------- ------------------------
+ /* ---------------- ------------------------- ------------------------
+ Band Stop zero: b +/- sqrt(b^2-FhFl) pole: b +/- sqrt(b^2-FhFl)
+ S(Fh-Fl) pole: +/- sqrt(-FhFl) zero: +/- sqrt(-FhFl)
+ S -> C -------- gain: -x gain: -1/x
+ S^2+FhFl b=C/x (Fh-Fl)/2 b=C/x (Fh-Fl)/2
+ ---------------- ------------------------- ------------------------ */
- if (W.length() != 2)
+ if (W.size() != 2)
throw std::invalid_argument("sftrans: BANDSTOP frequency list must be
two long");
- double Fl=W(1), Fh=W(2);
+ double Fl=W[1], Fh=W[2];
if ((lz > lp) || (lp==0))
throw std::invalid_argument("sftrans: must have at least as many poles
as zeros in s-plane");
if (lz == 0) {
- gr_complex Z=1;
+ gr_complexd Z=1;
for (int i=0;i<lp;i++)
- Z *= gr_complex(-pole(2*i),-pole(2*i+1));
+ Z *= gr_complexd(-pole[2*i],-pole[2*i+1]);
k /= Z.real();
} else if (lp == 0) {
- gr_complex Z=1;
+ gr_complexd Z=1;
for (int i=0;i<lp;i++)
- Z *= gr_complex(-zero(2*i),-zero(2*i+1));
+ Z *= gr_complexd(-zero[2*i],-zero[2*i+1]);
k *= Z.real();
} else {
- gr_complex Z=1;
+ gr_complexd Z=1;
+ for (int i=0;i<lz;i++)
+ Z *= gr_complexd(-zero[2*i],-zero[2*i+1]);
for (int i=0;i<lp;i++)
- Z *= gr_complex(-zero(2*i),-zero(2*i+1));
- for (int i=0;i<lp;i++)
- Z /= gr_complex(-pole(2*i),-pole(2*i+1));
+ Z /= gr_complexd(-pole[2*i],-pole[2*i+1]);
k *= Z.real();
}
for (int i=0;i<lp;i++) {
- gr_complex Z = gr_complex(pole(2*i),pole(2*i+1));
- Z = (C*(Fh-Fl))/2.0/Z;
+ gr_complexd Z = gr_complexd(pole[2*i],pole[2*i+1]);
+
+ Z = ((C*(Fh-Fl))/2.0)/Z;
+
//Z =
-
+ }
+ return rtn;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11635 - gnuradio/branches/developers/n4hy/pfb_iir/gnuradio-core/src/lib/general,
n4hy <=