mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
active: s/M_PI/pi
This commit is contained in:
parent
b311f8ab22
commit
b51b31f956
@ -188,7 +188,7 @@ void Filter::calcFirstOrder()
|
||||
float R1, R2,R3;
|
||||
|
||||
int k = order/2 + 1;
|
||||
float Wc = 2*M_PI*Fc;
|
||||
float Wc = 2*pi*Fc;
|
||||
float re = Poles.at(k-1).real();
|
||||
//float im = Poles.at(k-1).imag();
|
||||
//float C = re*re + im*im;
|
||||
@ -369,8 +369,8 @@ void Filter::calcChebyshev()
|
||||
Zeros.clear();
|
||||
|
||||
for (int k=1;k<=N;k++) {
|
||||
float re = -1*a*sin(M_PI*(2*k-1)/(2*N));
|
||||
float im = b*cos(M_PI*(2*k-1)/(2*N));
|
||||
float re = -1*a*sin(pi*(2*k-1)/(2*N));
|
||||
float im = b*cos(pi*(2*k-1)/(2*N));
|
||||
std::complex<float> pol(re,im);
|
||||
Poles.append(pol);
|
||||
}
|
||||
@ -394,8 +394,8 @@ void Filter::calcButterworth()
|
||||
Zeros.clear();
|
||||
|
||||
for (int k=1;k<=N2;k++) {
|
||||
float re =-1*sin(M_PI*(2*k-1)/(2*N2));
|
||||
float im =cos(M_PI*(2*k-1)/(2*N2));
|
||||
float re =-1*sin(pi*(2*k-1)/(2*N2));
|
||||
float im =cos(pi*(2*k-1)/(2*N2));
|
||||
std::complex<float> pol(re,im);
|
||||
Poles.append(pol);
|
||||
}
|
||||
@ -421,13 +421,13 @@ void Filter::calcInvChebyshev() // Chebyshev Type-II filter
|
||||
float b = cosh((asinh(1.0/eps))/(order));
|
||||
|
||||
for (int k=1;k<=order;k++) {
|
||||
float im = 1.0/(cos(((2*k-1)*M_PI)/(2*order)));
|
||||
float im = 1.0/(cos(((2*k-1)*pi)/(2*order)));
|
||||
Zeros.append(std::complex<float>(0,im));
|
||||
}
|
||||
|
||||
for (int k=1;k<=order;k++) {
|
||||
float re = -1*a*sin(M_PI*(2*k-1)/(2*order));
|
||||
float im = b*cos(M_PI*(2*k-1)/(2*order));
|
||||
float re = -1*a*sin(pi*(2*k-1)/(2*order));
|
||||
float im = b*cos(pi*(2*k-1)/(2*order));
|
||||
std::complex<float> invpol(re,im); // inverse pole
|
||||
std::complex<float> pol;
|
||||
pol = std::complex<float>(1.0,0) / invpol; // pole
|
||||
@ -496,7 +496,7 @@ void Filter::calcCauer() // from Digital Filter Designer's handbook p.103
|
||||
sum = 0.0;
|
||||
for(int m=0;m<5;m++) {
|
||||
float term = pow(-1.0,m)*pow(q,m*(m+1));
|
||||
term = term*sin((2*m+1)*M_PI*mu/order);
|
||||
term = term*sin((2*m+1)*pi*mu/order);
|
||||
sum += term;
|
||||
}
|
||||
numer = 2.0*sum*sqrt(sqrt(q));
|
||||
@ -504,7 +504,7 @@ void Filter::calcCauer() // from Digital Filter Designer's handbook p.103
|
||||
sum = 0.0;
|
||||
for(int m=1;m<5;m++) {
|
||||
float term = pow(-1.0,m)*pow(q,m*m);
|
||||
term = term*cos(2.0*m*M_PI*mu/order);
|
||||
term = term*cos(2.0*m*pi*mu/order);
|
||||
sum += term;
|
||||
}
|
||||
denom = 1.0+2.0*sum;
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
|
||||
static const double pi = 3.1415926535897932384626433832795029; /* pi */
|
||||
|
||||
struct RC_elements {
|
||||
int N;
|
||||
float R1;
|
||||
|
@ -271,7 +271,7 @@ void MFBfilter::createBandStopSchematic(QString &s)
|
||||
void MFBfilter::calcHighPass()
|
||||
{
|
||||
float R1,R2,C1,C2;
|
||||
float Wc = 2*M_PI*Fc;
|
||||
float Wc = 2*pi*Fc;
|
||||
float Nst = order/2 + order%2;
|
||||
float Kv1 = pow(Kv,1.0/Nst);
|
||||
|
||||
@ -306,7 +306,7 @@ void MFBfilter::calcHighPass()
|
||||
void MFBfilter::calcLowPass()
|
||||
{
|
||||
float R1,R2,R3,C1,C2;
|
||||
float Wc = 2*M_PI*Fc;
|
||||
float Wc = 2*pi*Fc;
|
||||
float Nst = order/2 + order%2;
|
||||
float Kv1 = pow(Kv,1.0/Nst);
|
||||
|
||||
@ -340,7 +340,7 @@ void MFBfilter::calcLowPass()
|
||||
|
||||
void MFBfilter::calcBandPass()
|
||||
{
|
||||
float W0 = 2*M_PI*F0;
|
||||
float W0 = 2*pi*F0;
|
||||
float R1,R2,R3,C1,C2;
|
||||
//float rho = Kv/Q;
|
||||
//float gamma = 1.0;
|
||||
|
@ -36,7 +36,7 @@ SallenKey::SallenKey(Filter::FilterFunc ffunc_, Filter::FType type_, FilterParam
|
||||
void SallenKey::calcLowPass()
|
||||
{
|
||||
float R1,R2,R3,R4,C1,C2;
|
||||
float Wc = 2*M_PI*Fc;
|
||||
float Wc = 2*pi*Fc;
|
||||
float Nst = order/2 + order%2;
|
||||
float Kv1 = pow(Kv,1.0/Nst);
|
||||
|
||||
@ -80,7 +80,7 @@ void SallenKey::calcLowPass()
|
||||
void SallenKey::calcHighPass()
|
||||
{
|
||||
float R1,R2,R3,R4,C1;
|
||||
float Wc = 2*M_PI*Fc;
|
||||
float Wc = 2*pi*Fc;
|
||||
|
||||
float Nst = order/2 + order%2;
|
||||
float Kv1 = pow(Kv,1.0/Nst);
|
||||
@ -124,7 +124,7 @@ void SallenKey::calcHighPass()
|
||||
|
||||
void SallenKey::calcBandPass()
|
||||
{
|
||||
float W0 = 2*M_PI*F0;
|
||||
float W0 = 2*pi*F0;
|
||||
float R1,R2,R3,R4,C1;
|
||||
//float rho = Kv/Q;
|
||||
//float gamma = 1.0;
|
||||
|
@ -36,7 +36,7 @@ SchCauer::SchCauer(Filter::FilterFunc ffunc_, Filter::FType type_, FilterParam p
|
||||
void SchCauer::calcLowPass()
|
||||
{
|
||||
float R1,R2,R3,R4,R5,C1,C2;
|
||||
float Wc = 2*M_PI*Fc;
|
||||
float Wc = 2*pi*Fc;
|
||||
float Nst = order/2 + order%2;
|
||||
float Kv1 = pow(Kv,1.0/Nst);
|
||||
//qDebug()<<Kv1;
|
||||
@ -79,7 +79,7 @@ void SchCauer::calcLowPass()
|
||||
void SchCauer::calcHighPass()
|
||||
{
|
||||
float R1,R2,R3,R4,R5,C1,C2;
|
||||
float Wc = 2*M_PI*Fc;
|
||||
float Wc = 2*pi*Fc;
|
||||
float Nst = order/2 + order%2;
|
||||
float Kv1 = pow(Kv,1.0/Nst);
|
||||
//qDebug()<<Kv1;
|
||||
@ -121,7 +121,7 @@ void SchCauer::calcHighPass()
|
||||
void SchCauer::calcBandPass()
|
||||
{
|
||||
float R1,R2,R3,R4,R5,R6,R7,C1,C2;
|
||||
float W0 = 2*M_PI*F0;
|
||||
float W0 = 2*pi*F0;
|
||||
float Kv1 = pow(Kv,1.0/order);
|
||||
int cnt = 1;
|
||||
|
||||
@ -192,7 +192,7 @@ void SchCauer::calcBandPass()
|
||||
void SchCauer::calcBandStop()
|
||||
{
|
||||
float R1,R2,R3,R4,R5,R6,C1,C2;
|
||||
float W0 = 2*M_PI*F0;
|
||||
float W0 = 2*pi*F0;
|
||||
float Kv1 = pow(Kv,1.0/order);
|
||||
int cnt = 1;
|
||||
float A=0,A2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user