fix quality factor formula

This commit is contained in:
Jan Käberich 2023-07-24 10:28:44 +02:00
parent 8962965883
commit d0620287a2

View File

@ -99,7 +99,8 @@ namespace Util {
return SparamToImpedance(d, Z0).imag() / (2.0 * M_PI * freq); return SparamToImpedance(d, Z0).imag() / (2.0 * M_PI * freq);
} }
static inline double SparamToQualityFactor(std::complex<double> d) { static inline double SparamToQualityFactor(std::complex<double> d) {
return abs(d.imag()) / d.real(); auto imp = SparamToImpedance(d);
return abs(imp.imag()) / imp.real();
} }
// attempts to return a font color with good contrast against the given background color // attempts to return a font color with good contrast against the given background color
static inline QColor getFontColorFromBackground(QColor q) { static inline QColor getFontColorFromBackground(QColor q) {