Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Approximating Non Linear Systems by Using The Matrix Eponential

  1. Jul 17, 2009 #1
    I tried posting this to my blog but the preview function wasn't rendering the formula's correctly and once I posted it I couldn't edit it.

    https://www.physicsforums.com/blog.php?b=1152 [Broken]

    Therefor I'll post it here instead.

    For simplicity let's consider a very simple ODE.

    [tex]\dot{x_1}=a x_1^2[/tex]

    We can approximate this first order system with a second order ODE as follows:

    [tex]
    \left[ \begin{array}{c}
    \dot{x_1} \\
    \dot{x_2} \end{array} \right]
    =
    \left[ \begin{array}{ccc}
    0 & 1 \\
    0 &
    \frac{d f(x_1)}{d x_1}
    \end{array} \right]

    \left[ \begin{array}{c}
    x_1 \\
    x_2 \end{array} \right]
    [/tex]

    Where

    [tex]
    x_2=\frac{dx_1}{dt}
    [/tex]

    Or in the simple case mentioned above we have:

    [tex]
    \left[ \begin{array}{c}
    \dot{x_1} \\
    \dot{x_2} \end{array} \right]
    =
    \left[ \begin{array}{ccc}
    0 & 1 \\
    0 & 2x_1(t_o) \end{array} \right]

    \left[ \begin{array}{c}
    x_1 \\
    x_2 \end{array} \right]
    [/tex]




    Using the matrix exponential the solution to the linear approximation of this stem as follows:

    [tex]
    \left[ \begin{array}{c}
    x(t) \\
    \dot{x}(t) \end{array} \right]
    =
    exp \left( \left[ \begin{array}{ccc}
    0 & 1 \\
    0 &
    2x_1(t_o) \end{array} \right] (t-t_o) \right)

    \left[ \begin{array}{c}
    x(t_o)) \\
    \dot{x}(t_o) \end{array} \right]
    [/tex]

    Where:

    [tex]\dot{x}(t_o)=ax(t_o)^2[/tex]

    Keep in mind the choice of using a second order approximation was somewhat arbitrary. We could of equally well, done a third order approximation as follows:

    [tex]
    \left[ \begin{array}{c}
    \dot{x_1} \\
    \dot{x_2} \\
    \dot{x_3} \end{array} \right]
    =
    \left[ \begin{array}{ccc}
    0 & 1 & 0\\
    0 & 0 & 1\\
    0 & 2 a & 2 a x(t_o)
    \end{array} \right]

    \left[ \begin{array}{c}
    x_1 \\
    x_2 \\
    x_3 \end{array} \right]
    [/tex]

    Where

    [tex]
    x_2=\frac{dx_1}{dt}, x_3=\frac{d^2x_1}{dt^2}

    [/tex]

    and

    [tex]\dot{x}(t_o)=ax(t_o)^2[/tex]
    [tex]\ddot{x}(t_o)=2 a x(t_o) \dot{x}(t_o)=2a^2x(t_o)^3[/tex]


    Which can also be solved using the matrix exponential.
     
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Jul 18, 2009 #2
    Scaling and Squaring

    In the last post it was shown how to approximate a non linear system with a linear system of arbitrary order. This has several advantages over standard ODE numeric algorithms.

    1) There is the potential to take larger step sizes.
    2) It is useful in estimation problems because we can derive linear relationships between the current state and the future value.
    3) We can develop expressions for error propagation
    4) It allows if desired the separation of fast and slow dynamics (note that this is also done in ODE solvers for stiff systems)
    5) Error propagation can be reduced by the use of scaling and squaring.

    As for possible disadvantages:

    1) The computation of the matrix exponential could be complex for high order systems.
    2) Numerical problems could arise if there are high order poles or poles which are close together.
    3) Some linearities may not be approximated well with linear systems.

    Now, well the algorithm allows for the potential of large step sizes this is more a matter of efficiency then numerical accuracy unless the matrix exponential is computed by using matrix denationalization. Matrix diagonalization only tends to be more accurate if the state space matrix is near symmetric (loosely coupled systems). Otherwise scaling and squaring algorithms tend to be more reliable in computing the matrix exponential.

    The scaling and squaring principle works on the premises that:

    [tex]exp(A)=exp(A/s)^s[/tex]

    Where [tex]A[/tex] is a matrix and [tex]s[/tex] is a constant.

    (note that it is easy to show that is in gneral doesn't work if [tex]s[/tex] is a matrix unless [tex]A[/tex] and [tex]S[/tex] commute.)

    [tex]A[/tex] is scaled by [tex]s[/tex] to be sufficiently small so that [tex]exp(A/s)[/tex] can be approximated with a pade approximation. The squaring is done recursively. That is:

    [tex]A^n=A^{n/2}A^{n/2}[/tex]

    This reduces numerical error and the number of multiplications.

    The choice of [tex]s[/tex] is critical because if [tex]s[/tex] is too large then there will be too much error introduced by the pade approximation but if [tex]s[/tex] is too small then there will be too much error introduced by the squaring part of the algorithm.

    It should be noted that when solving the differential equation we are computing the matrix exponential of [tex]At[/tex]. If [tex]s[/tex] is our scaling factor then as long as the time step is not less then [tex]t/s[/tex] we will not introduce any additional error by taking intermediate steps. Therefor if our only concern is accuracy we should compute the matrix exponential of [tex]At/s[/tex] for each time step.

    If we were naive then we could now solve the differential equation as follows:

    [tex]\boldsymbol{x}(t+t/s)=exp(A(t)t/s)\boldsymbol{x}(t)[/tex]

    This has the advantage over taking large time steps in that we can recompute the matrix exponential each time step but the disadvantage that it requires n multiplication for n step. This could result in large error propagation.

    Well, we may need to do this to initially compute our state space matrix for the next time step once we have initialized the state space matrices we can reculculate the value of the the states based on large time steps using the following recursive relationship.

    [tex]exp(A(t_1,t_2))=exp \left( A \left( t_1,\frac{t_2+t_1}{2} \right) \right) exp \left( A \left( \frac{t_2+t_1}{2},t_1 \right) \right) [/tex]

    Where the recursion is terminated when [tex]t_2-t_1[/tex] is sufficiently small that we can approximate an average state transition matrix over the interval [tex][t_2,t_1][/tex]. Example approximations include:

    [tex]exp(A(t_1,t_2)) \approx exp(A(t_1)(t_2-t_1))[/tex]
    [tex]exp(A(t_1,t_2)) \approx exp \left( \frac{A(t_1)+A(t_2)}{2} (t_2-t_1) \right) \right)[/tex]

    We expect good numerical accuracy if we can make the above approximation when [tex]t_2-t_1[/tex] is above or at least not a lot smaller then the chosen scale factor [tex]s[/tex].

    Intuitively this scaling and squaring should improve numerical accuracy as additions and subtractions will take place with respect to numbers that will likely be more simmilar in magnitude. (I'll see if I can find a proof).
     
  4. Jul 20, 2009 #3
    Re: Adding Corrective Feedback.

    In my firt Post we considered second order approximations:


    [tex]

    \left[ \begin{array}{c}
    \dot{x_1} \\
    \dot{x_2} \end{array} \right]
    =
    \left[ \begin{array}{ccc}
    0 & 1 \\
    0 &
    \frac{d f(x_1)}{d x_1}
    \end{array} \right]

    \left[ \begin{array}{c}
    x_1 \\
    x_2 \end{array} \right]

    [/tex]

    of the system:

    [tex]
    \dot{x_1}=a x_1^2
    [/tex]

    Giving the linear approximation:

    [tex]

    \left[ \begin{array}{c}
    \dot{x_1} \\
    \dot{x_2} \end{array} \right]
    =
    \left[ \begin{array}{ccc}
    0 & 1 \\
    0 & 2x_1(t_o) \end{array} \right]

    \left[ \begin{array}{c}
    x_1 \\
    x_2 \end{array} \right]

    [/tex]

    In this approximation we:
    - Derive an expression for [tex]\ddot{x}[/tex] from the first order differential equation.
    -The [tex]\ddot{x}[/tex] is approximated as a linear function of the first derivative.
    -The [tex]x[/tex] is computed as the integral of [tex]\dot{x}[/tex].

    Because the resulting differential exultation computes [tex]x[/tex] purely as an integral of [tex]\dot{x}[/tex], the computation is metastable. This could unnecessarily increase error propagation. To correct this we should feed back information about [tex]x[/tex] into the computation of [tex]\ddot{x}[/tex].



    The error in our computation of [tex]\ddot{x}[/tex] is given by:

    [tex]e(\ddot{x})=\left(\frac{df(x)}{dx}-\frac{df(x(t_o))}{dx}\right)(\dot{x}-\dot{x}_)[/tex]
    Or in our example:
    [tex]e(\ddot{x})=2\left(x-x_o\right)(\dot{x}-\dot{x}_o)[/tex]
    [tex]e(\ddot{x})=2\left(x-x_o\right)(x^2-\dot{x}_o)[/tex]
    [tex]e(\ddot{x})=2(x^3-x\dot{x}_o-x_ox^2+\dot{x}_ox_o)[/tex]
    differentiating with respect to x:
    [tex]\dot{e}(\ddot{x})=2(3x^2-\dot{x}_o-2x_ox)[/tex]
    [tex]\dot{e}(\ddot{x})=4x_o^2-4x_o^3[/tex]




    [tex]

    \left[ \begin{array}{c}
    \dot{x_1} \\
    \dot{x_2} \end{array} \right]
    =
    \left[ \begin{array}{ccc}
    0 & 1 \\
    (4x_o^2-4x_o^3) & 2x_1(t_o) \end{array} \right]

    \left[ \begin{array}{c}
    x_1 \\
    x_2 \end{array} \right]
    +
    \left[ \begin{array}{c}
    0 \\
    -(4x_o^2-4x_o^3)x_o \end{array} \right]

    [/tex]
     
    Last edited: Jul 20, 2009
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Approximating Non Linear Systems by Using The Matrix Eponential
Loading...