# Genral state space model - runge kutte

1. Apr 19, 2008

### ash4sigh

Hi,

Really glad to have found this site... I was hoping someone could help me - have been trying to decipher how to find a way to solve general n order state space model - I started off with RK4 and now I want to expand that but I can't get my head wrapped around the butcher tableau to generate code for n order state space model..

any help would be appreciated..

sorry *general

Last edited: Apr 19, 2008
2. Apr 19, 2008

### ash4sigh

hell i dont even know if i need butcher tableau - lost!!

3. Apr 20, 2008

### HallsofIvy

You've lost me too! I thought I knew differential equations but I don't recognize "n order state space" nor "Butcher tableau"!

4. Apr 20, 2008

### ash4sigh

sniff

5. Apr 20, 2008

### trambolin

What he means is just a matrix ODE given as in a compact fashion
$$\dot{x} = Ax+Bu, y = Cx + Du$$
where A,B,C,D are matrices. This is usually referred as a State-Space model of a system.

You can just use MATLAB/simulink for your system. For that you don't need anything else, it does it for you. Or you can just pick up a sample time and update your states at each sample time e.g. Newton's method. If you insist on RK4 it is similar to Runge Kutta 4 for scalar ODEs. just make sure that what you are doing is the same with why you are doing.

Of course if you have the input function known in time domain, you can solve the convolution integral

$$y=Ce^{At}x_0 + C\int^t_0{e^{A(t-\tau)}Bu(\tau)d\tau}$$

or the Laplace equivalent of this (in terms of a transfer function), (if you know your input function's Laplace domain representation!)
$$y(s) = (C(sI-A)^{-1}B + D)u(s)$$

Butcher Tableau is not useful here. Just forget about it.

6. Apr 20, 2008

### D H

Staff Emeritus
What do you mean by "general n order state space model"? I assume you mean that you have a functional representation for the nth derivative of the state with respect to time,

$$\frac {d^n}{dt^n} x(t) = x^{(n)}(t) = g(t,x(t),x^{(1)}(t),\cdots,x^{(n-1)}(t))$$

Such systems can be converted to a first-order ODE by making the derivatives up to order n-1 a part of the state. You then have a plethora of first-order ODE techniques from which to choose, Runge-Kutta methods being just one class.

RK4 is the gold standard, not so much because it is particularly good but more because it is often adequate and particular easy to implement. Lower order methods such as Heun's method (aka velocity verlet) can yield good results at a lower cost. What problems are you confronting, and what have you tried?

You probably don't need to use the Butcher tableau. Most of the work on Runge-Kutta methods was done a long time ago.

7. May 1, 2008

### kev08106

help on state space HW

Edited by HallsofIvy
I have removed this because

1) It introduced a totally new problem, not that of the original poster.

2) It has also been posted under "homework".

Last edited by a moderator: May 2, 2008