Added band-pass filter order estimation

This commit is contained in:
Vadim Kuznetzov 2014-09-05 16:01:00 +04:00 committed by Guilherme Brondani Torri
parent 936079872a
commit 9d2d1e7c77
2 changed files with 15 additions and 2 deletions

View File

@ -37,8 +37,18 @@ Filter::Filter(Filter::FilterFunc ffunc_, Filter::FType type_, FilterParam par)
Fl = par.Fl;
Fu = par.Fu;
TW = par.TW;
BW = fabs(Fu -Fl);
F0 = sqrt(Fu*Fl);
Q = F0/abs(Fu-Fl);
Fc=BW; // cutoff freq. of LPF prototype
float Fs1 = Fu + TW;
float Fs1lp = fabsf(Fs1 - (F0*F0)/Fs1); // stopband freq. of LPF prototype
float Fs2 = Fl - TW;
float Fs2lp = fabsf(Fs2 - (F0*F0)/Fs2);
Fs = std::min(Fs1lp,Fs2lp);
Ap = 3.0;
As = 20.0;
qDebug()<<Fc<<Fs;
Q = F0/fabs(Fu-Fl);
}
Rp = par.Rp;

View File

@ -34,8 +34,11 @@ MFBfilter::MFBfilter(Filter::FilterFunc ffunc_, Filter::FType type_, FilterParam
Nr1=2;
Nc1=3;
break;
default:
case Filter::BandPass :
Nr1=3;
Nc1=2;
break;
default : break;
}
//Nr1 = 3;