Let's assume that we have the data $y(t), u(t)$ and it's from a first order ODE:
$$ \dot y(t) + a y(t) = b u(t) $$
But we have a ODE form at third order: $$ \dddot y(t) + a \ddot y(t) + b \dot y(t) + cy(t) = d u(t) + d \dot u(t) $$
To estimate, I like to do that in this way:
$$ \dddot y(t) = -a \ddot y(t) - b \dot y(t) - cy(t) + d u(t) + d \dot u(t) $$
Then I set this on the form:
$$b = Ax$$
Where I solve $x$ with pseudo inverse:
$$x = A ^ {\dagger} b$$
Or I can set the equation like this:
$$ 0 = -a \dddot y(t) -b \ddot y(t) - c \dot y(t) - dy(t) + e u(t) + f \dot u(t) $$
And find the null space parameters.
The problem is that I try to curve fit first order ODE on a third order ODE form. Is there any way or algoritm to avoid this problem, because I don't know if my data is first order, second order or third order or higher.
How do I know if I should use first order, second order or third order ODE if I got input and output data $u(t), y(t)$ ?
I found the answer!
I try to minimize $ min _x ||Ax - b||$ where $A$ is my candidate functions of the derivatives and input $u$. The function glpk is a GNU Octave function for linear programming. Very fast!
$x$ will be for example $[3.1, 0, 0, 0, 0, 0, 2.3, 0]$ for a first order data.