#include #include #include "ivp.h" #include "vec.h" // The critical frequency double const fc{ 0.5 }; // Function declarations int main(); double v( double t ); #include "lowpass.h" // Input signal double v( double t ) { return std::sin(t) + std::sin(10*t); } int main() { std::cout.precision( 6 ); std::clog.precision( 16 ); ivp> y{ f, 0.0, 0.0, 0.05, std::make_pair( 1e-5, 0.1 ), 1e-5, vec<1>::norm }; double t_max{ 20.0 }; double step{ 0.1 }; // Calculate this once, so that it finds an approximation // for all values on the interval [0, t_max] y( t_max ); std::cout << "L := [" << std::endl; for ( double t{0.0}; t < t_max + 0.5*step; t += step ) { std::cout << "[" << t << ", " << y( t )[0] << "]," << std::endl; } std::cout << "NULL]:" << std::endl; std::cout << "phase := " << phase( 1.0/(2.0*M_PI) ) << ":" << std::endl; return 0; }