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

How to give a step input in Matlab?

  1. Sep 25, 2015 #1

    I have a state space equation at hand.. This attached with this...
    Now the term (theta double dot) is a positive step for 0,136 milli seconds and negative step for next 0,136 millisecond and 0 at all other times.
    So that when I simulate I will get a graph as below:
    This is the nature of the graph I am expecting.

    Iam using Matlab ODE45 to solve this. It is pretty easy I think, but I cant figure out how to give this acceleration function.

    I hope the question is clear. The values are

    Omega = 219,
    Zeta = 0,03
    Gamma(i) divided by M(i)=0,01
    theta double dot = -63 and +63 in the above said intervals respectively.

    Attached Files:

  2. jcsd
  3. Sep 25, 2015 #2


    User Avatar

    Staff: Mentor

    Posting code would be more helpful than that picture :smile:

    The value of the independent variable (t in your case) is passed to the user-defined function calculating the derivatives. You can easily calculate the value of ##\ddot{\theta}## in that function using if's based on the value of t.
  4. Sep 28, 2015 #3
    The code I used and the results are attached here. Obviously its wrong. The expected nature of the curve is like the one shown in the first post( the oscilloscope display). Please help if anyone knows. matlab code.JPG command line.JPG matlab graph.JPG
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook