Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Commit

Permalink
Started user defined transfer function poles and zeros calcultion imp…
Browse files Browse the repository at this point in the history
…lementation
  • Loading branch information
ra3xdh committed May 14, 2014
1 parent 8f66ceb commit 1c06027
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions filter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "filter.h"
#include "qf_poly.h"

Filter::Filter(Filter::FilterFunc ffunc_, Filter::FType type_, FilterParam par)
{
Expand Down Expand Up @@ -59,6 +60,7 @@ bool Filter::calcFilter()
break;
case Filter::InvChebyshev : calcInvChebyshev();
break;
case Filter::User : calcUserTrFunc();
default : return false;
break;
}
Expand Down Expand Up @@ -442,3 +444,22 @@ void Filter::calcCauer() // from Digital Filter Designer's handbook p.103
Poles.append(std::complex<float>(re,-im));
}
}

void Filter::calcUserTrFunc()
{
long double a[3]={1,2,1};
long double b[3]={2,2,1};


qf_poly Numenator(2,a);
qf_poly Denomenetor(2,b);

Numenator.to_roots();
Denomenetor.to_roots();

Numenator.disp_c();
Denomenetor.disp_c();

Numenator.roots_to_complex(Zeros);
Denomenetor.roots_to_complex(Poles);
}
1 change: 1 addition & 0 deletions filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Filter
void calcInvChebyshev();
void calcCauer();
void calcBessel();
void calcUserTrFunc();
bool checkRCL(); // Checks RCL values. Are one of them NaN or not?

void createFirstOrderComponentsHPF(QString &s,RC_elements stage, int dx);
Expand Down

0 comments on commit 1c06027

Please sign in to comment.