I'm developing a simulation software in Qt (C++) which has to take an input (u) for a SISO dynamic system defined by matrices A, B, C, D and get the output (y) based on a initial state (x0):
dx = Ax + Bu
y = Cx + Du
That kind of stuff can be done by using Matlab's function LSIM... I know that I can define the differential equations and solve them numerically, however defining them and solve them in a proper order is a little bit tricky, so, I'm wondering if anyone knows if there is an existing C++ library or C++ example which can do that...
Edit from here...
I'm developing my Qt application as a standalone app, without Matlab... So I thought that there is a way in which I have something like this if I have a 2-state system for one state of the system:
double y(double A[2][2], double B[2], double C[2], double D, double XAct[2], double XNext[2], double u)
But nevermind, I found that I can do something like this:
X[k+1] = A*X[k] + B*u[k]
y[k] = C*X[k] + D*u[k]
However I'm worried about timestamps so... I don't know if this is correctly for systems with an array as an input... I suppose that yes but...