Skip to content

Commit

Permalink
The cutoff needs to be below Nyquist and cannot be equal to Nyquist a…
Browse files Browse the repository at this point in the history
…s the

pre-warp will drive it to infinity at Nyquist.
  • Loading branch information
berndporr committed Jan 9, 2021
1 parent d00a03e commit 8ef23b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions iir/PoleFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace Iir {
//------------------------------------------------------------------------------


static const char cutoffError[] = "The cutoff frequency needs to be below or equal to the Nyquist frequency.";
static const char cutoffError[] = "The cutoff frequency needs to be below the Nyquist frequency.";
static const char cutoffNeg[] = "Cutoff frequency is negative.";

complex_t LowPassTransform::transform (complex_t c)
Expand All @@ -61,7 +61,7 @@ LowPassTransform::LowPassTransform (double fc,
LayoutBase const& analog)
{

if (fc > 0.5) throw std::invalid_argument(cutoffError);
if (!(fc < 0.5)) throw std::invalid_argument(cutoffError);
if (fc < 0.0) throw std::invalid_argument(cutoffNeg);

digital.reset ();
Expand Down Expand Up @@ -107,7 +107,7 @@ HighPassTransform::HighPassTransform (double fc,
LayoutBase& digital,
LayoutBase const& analog)
{
if (fc > 0.5) throw std::invalid_argument(cutoffError);
if (!(fc < 0.5)) throw std::invalid_argument(cutoffError);
if (fc < 0.0) throw std::invalid_argument(cutoffNeg);

digital.reset ();
Expand Down Expand Up @@ -142,7 +142,7 @@ BandPassTransform::BandPassTransform (double fc,
LayoutBase& digital,
LayoutBase const& analog)
{
if (fc > 0.5) throw std::invalid_argument(cutoffError);
if (!(fc < 0.5)) throw std::invalid_argument(cutoffError);
if (fc < 0.0) throw std::invalid_argument(cutoffNeg);

digital.reset ();
Expand Down Expand Up @@ -226,7 +226,7 @@ BandStopTransform::BandStopTransform (double fc,
LayoutBase& digital,
LayoutBase const& analog)
{
if (fc > 0.5) throw std::invalid_argument(cutoffError);
if (!(fc < 0.5)) throw std::invalid_argument(cutoffError);
if (fc < 0.0) throw std::invalid_argument(cutoffNeg);

digital.reset ();
Expand Down

0 comments on commit 8ef23b0

Please sign in to comment.