How to give a step input in Matlab?

Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 2K views · last reply
Ben9622111222
Messages
31
Reaction score
0
Hello,

I have a state space equation at hand.. This attached with this...
State-space matrix equation: [x1-dot; x2-dot] = [[0, 1], [-omega1^2, -2 zeta omega1]] [x1; x2] + [0; Gamma_i/M_i] theta-double-dot(t).

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:
Oscilloscope screenshot in Stop mode showing two traces: a yellow channel 1 trace with a damped oscillation that dips, rises to a peak, then settles, and a white channel 2 trace that rises from low to a plateau.

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 can't 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.
 
Attachments
  • Oscilloscope screen in Stop mode showing two traces: a yellow channel 1 trace with an oscillating burst that rises, swings negative and settles, and a white channel 2 trace that rises in a curve and levels off. Channel 1 is set to 500 mV per division and channel 2 to 1.00 A per division, with 100 ms per division timebase.
    upload_2015-9-25_7-59-11.png
    144.2 KB · Views: 524
Physics news on Phys.org
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.
 
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.
Screenshot of MATLAB code defining a state-space function sys(t,x) with matrices A and B, and a piecewise input function u(t) that gives -63 for 0 < t < 0.136, 63 for 0.136 < t < 0.270, and 0 otherwise.
Screenshot of MATLAB code: t0=0; tfinal=0.8; x0=[0 0]; [t,x]=ode45(@sys,[t0 tfinal],x0); plot(t,x)
MATLAB plot of a green oscillating signal against time from 0 to 0.8, amplitude decaying from about 0.05 to near zero by 0.6, with a flat black line along zero.