C++ Complex Typ nach Pascal



  • Hallöchen,
    Ich habe eine kleine c++ lib die ich gerne nach -
    ich mags ja gar nicht schreiben Delphi konvertiere.
    Jetzt hänge ich leider an diesen Typ Complex ?
    response.real oder imag = 1234 das verstehe ich ja noch
    aber response = 10+10+10 ??
    Kann mir da jemand helfen wie ich das in Pascal lösen kann ?
    Da gibt es ja die JCLComplex.
    Vielen Dank schonmal
    Totti

    #include <math.h>
    #include <complex>
    
    //void BIQUAD::GetFrqResponse(f64 &module_dB, f64 &phase_degree, f64 f_Hz)
    // b0, b1, b2, a1, a2: double;            // biquad unquantized coeffs
    {
    complex response;
    double omega;
    
    omega = 2.0*PI*f_Hz/fs;
    
    complex z1(cos(omega),sin(omega));         // Z^(-1)
    complex z2(cos(2.0*omega),sin(2.0*omega)); // Z^(-2)
    
    response = (b0 + (b1*z1) + (b2*z2))/(1.0 + (a1*z1) + (a2*z2));
    
    module_dB       = 20.0*log10(sqrt(srd(response.real()) + srd(response.imag())));
    phase_degree    = (180.0/PI)*atan2(response.imag(),response.real());
    }
    

Anmelden zum Antworten