[Kst] branches/work/kst/1.6/kst/src/plugins/discretizing_filters
Andrew Walker
arwalker at sumusltd.com
Wed Jan 23 01:52:50 CET 2008
SVN commit 765034 by arwalker:
format changes
M +1 -1 filter.h
M +14 -8 genericfilter.cpp
--- branches/work/kst/1.6/kst/src/plugins/discretizing_filters/filter.h #765033:765034
@@ -1,6 +1,6 @@
/******************************************************************************
* filter.h : Digital Filter. Specified by its "s" transfer function. *
- * Synthesis of "z" transfert function is done by bilinear *
+ * Synthesis of "z" transfer function is done by bilinear *
* transformation : 2 z-1 *
* p -> --- ----- *
* T z+1 *
--- branches/work/kst/1.6/kst/src/plugins/discretizing_filters/genericfilter.cpp #765033:765034
@@ -54,23 +54,29 @@
int length = y->length();
// Extract polynom coefficients and instantiate polynoms
- QStringList numCoeffs =
- QStringList::split(QRegExp("\\s*(,|;|:)\\s*"), numerator->value());
- QStringList denCoeffs =
- QStringList::split(QRegExp("\\s*(,|;|:)\\s*"), denominator->value());
+ QStringList numCoeffs = QStringList::split(QRegExp("\\s*(,|;|:)\\s*"), numerator->value());
+ QStringList denCoeffs = QStringList::split(QRegExp("\\s*(,|;|:)\\s*"), denominator->value());
int numDegree = numCoeffs.count() - 1, denDegree = denCoeffs.count() - 1;
polynom<double> Num(numDegree), Den(denDegree);
double tmpDouble = 0.0;
bool ok = false;
+
for (int i=0; i<=numDegree; i++) {
tmpDouble = numCoeffs[i].toDouble(&ok);
- if (ok) Num[i]= tmpDouble;
- else Num[i] = 0.0;
+ if (ok) {
+ Num[i]= tmpDouble;
+ } else {
+ Num[i] = 0.0;
+ }
}
+
for (int i=0; i<=denDegree; i++) {
tmpDouble = denCoeffs[i].toDouble(&ok);
- if (ok) Den[i] = tmpDouble;
- else Den[i] = 0.0;
+ if (ok) {
+ Den[i] = tmpDouble;
+ } else {
+ Den[i] = 0.0;
+ }
}
// Time step
More information about the Kst
mailing list