Filtering and Control Library
Check out this header-only C++11 library of control and filter tools. Currently it features PID control, bi-quads (or second-order-sections), state-space systems and a PRBS (pseudo-random-binary-signal) system identification function.
The code-documentation and tests provide reference and example to use the library. Creating a second order floating-point state-space is easy:
using ss = control::system::ss<float,2>;
// State-transfer matrix
ss::TA A;
A << 1, 1, 0, 1;
// Input matrix
ss::TB B;
B << 0.5, 1;
// Output matrix
ss::TC C;
C << 1, 0;
// Feedtrough matrix
ss::TD D;
D << 0;
auto P = ss {A,B,C,D};
Under the hood, it uses the Eigen matrix library to allow vectorisation and optimisations.
Find it on Github at tomlankhorst/control.