Solving a matrix differential equation using Runge-Kutta methods

6.8k Views Asked by At

I could not find a control systems forum on stack exchange and so I am doing this here. Is it possible to solve the state space variable form of a system $\dot{x}=A\,x + B\,u$ using any order of Runge-Kutta method, and if so can anyone please tell me the method

1

There are 1 best solutions below

6
On

Runge-Kutta methods considers the problem $\dot{x}=f(t,x)$ with $x(t_0)=x_0$ and wants to find $x(t)$ at $t=t_0+n\,h$ for $n=1,2,3,...$. In your case $f(t,x)=A\,x+B\,u$, so you have choose how to interpret $u$ as a function of time. Often $u$ is also only sampled every $h$ time units, so two options would be to assume $u$ to be constant between sample steps (zero order hold), or perform linear interpolation (first order hold). If $u$ is know continuously, then you can directly evaluate $u(t)$ at the give sub time steps of the Runge-Kutta method.

For example when using the fourth order Runge-Kutta method with zero order hold, using $x_n=x(t_0+n\,h)$ and $u_n=u(t_0+n\,h)$, you get

\begin{align} x_{n+1}&=x_n+\frac{1}{6}\left(k_1+2\,k_2+2\,k_3+k_4\right) \\ k_1&=h\left(A\,x_n+B\,u_n\right) \\ k_2&=h\left(A\,(x_n+k_1/2)+B\,u_n\right)\\ k_3&=h\left(A\,(x_n+k_2/2)+B\,u_n\right)\\ k_4&=h\left(A\,(x_n+k_3)+B\,u_n\right)\\ \end{align}

Substituting these equations into each other gives

$$ x_{n+1} = \left(I + h\,A + \frac{h^2}{2!}A^2 + \frac{h^3}{3!}A^3 + \frac{h^4}{4!}A^4\right) x_n + \left(h\,I + \frac{h^2}{2}A + \frac{h^3}{3!}A^2 + \frac{h^4}{4!}A^3\right)B\,u_n $$

which is just the fourth order approximation of the zero order hold discretization, which can be expressed as

\begin{align} x_{n+1} &= e^{A\,h} x_n + A^{-1} (e^{A\,h} - I)B\,u_n \\ e^{A\,h} & = \sum_{i=0}^\infty \frac{1}{i!}(A\,h)^i \end{align}

Similarly one would obtain a fourth order approximation of the first order hold discretization when using first order hold for $u$. So when $u$ is sampled every $h$ time units and the system is LTI then using Runge-Kutta would just be an approximation of known discetization methods and you might as well use those methods instead. However if the sample frequency is sufficiently high compared to the system dynamics, then the difference between Runge-Kutta and the discetization methods should become negligible. If $u(t)$ is known at all time then Runge-Kutta might give more accurate results then the other mentioned discetization methods. And for LPV or LTV systems Runge-Kutta discetization should work as well, as long as the sample frequency is high enough.