Code: Select all
std::complex<double> z = std::polar(2*pi*f); Code: Select all
std::complex<double> z(cos(2*pi*f), sin(2*pi*f));Also the final post of the code was
Code: Select all
std::complex<double> h = (b0*z2 + b1*z + b0) / (z2 + a1*z + a2);Code: Select all
std::complex<double> h = (b0*z2 + b1*z + b2) / (z2 + a1*z + a2);Code: Select all
float mag = real(h); Code: Select all
float mag = abs(h); 