1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using expm of matlab to plot state responses

Tags:
  1. Feb 9, 2016 #1
    1. The problem statement, all variables and given/known data
    The state space model of a nonlinear system is [tex]x'_1(t) = 2x^2_2(t) - 50[/tex] [tex]x'_2(t) = -x_1(t) - 3x_2(t) + u(t)[/tex] where x_1(t) and x_2(t) are the states, and u(t) is the input. The output of the system is x_2(t).

    Find the zero input response (u(t) = 0) of this system linearized at the equilibrium point (-15, 5) with initial states (-14.5, 5). Use Matlab (expm.m) to plot these state responses from 0 to 5s.

    2. Relevant equations

    State Space Modeling, Matlab

    3. The attempt at a solution

    The bold part is where I have an issue with this problem. Generally, if you want to find response to initial conditions, you use initial function, not expm. Expm simply takes a matrix and exponentiates it.

    Anyways, matlab code for generating response to initial condition is:

    //State Matrix
    A = [ 0 20 ; -1 -3]
    B = [0 ; 1]
    C = [0 1]
    D = 0
    x0 = [ -14.5 ; 5]

    sys = ss(A,B,C,d)
    initial(sys, x0)

    And you get a beautiful plot looking like the following:

    image.png

    How, and especially why on earth would you use expm function to generate such plot?
     
  2. jcsd
  3. Feb 12, 2016 #2

    jasonRF

    User Avatar
    Science Advisor
    Gold Member

    Do you know what a matrix exponential is, and how it can be used to solve a system of linear, constant coefficient first order equations? If not, then either look in your textbook or google it. Even the Wikipedia page on the matrix exponential has some applications that should help here.

    Why would you do this? Because it will give you an idea of one way to solve such a system of ODEs analytically. Numerically, I do not know what the 'initial' command in matlab does (might just numerically integrate the equations - probably doesn't do the matrix exponential). I would think that anyone who learns about state space analysis should learn about matrix exponentials at some point. Perhaps that is the real reason 'why' you would do this - so you learn more than just how to use a few Matlab commands.

    enjoy,

    jason
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Using expm of matlab to plot state responses
  1. Matlab, plot (Replies: 5)

  2. Matlab plots (Replies: 1)

Loading...