MCE371: Vibrations Prof. Richter Department of Mechanical Engineering Handout 5 Fall 2011
State-Space Representations Output Equations State-Space vs. Differential Equations Follow Palm, Sect. 3.9 and pages 527-530 1 We can derive the equation of motion for a 1 DOF system: n-th order differential equation 2 By using state variables, we can replace 1 n-th order diff. eq. by n 1st order diff. eqs. 3 This is done to facilitate computer simulations and use modern methods of analysis 4 State-space representations are essential for future control systems and mechatronics studies.
Choosing State Variables State-Space Representations Output Equations Suppose we have the n-th order differential equation d n x a n dt n +a d n 1 x n 1 dt n 1 +...a 2ẍ +a 1 ẋ +a 0 x = bu We choose n state variables sequentially, to match x, ẋ, ẍ... dn 1 x dt n 1. Then we have: ẋ 1 = x 2 ẋ 2 = x 3. =. ẋ n 1 = x n (1)
Writing the state equations State-Space Representations Output Equations The last state derivative is found from the diff. eq. itself, as you did when building computer simulation diagrams. ẋ n = 1 a n { a n 1 x n 1 a n 2 x n 2... a 2 x 2 a 1 x +bu}
Example Introduction to State Variables State-Space Representations Output Equations Diff. eq: State variables: 2 d3 x ẍ +3ẋ +6x = 4u dx3 x 1 x x 2 ẋ x 3 ẍ The equations for the first n 1 state derivatives is always the same: ẋ 1 = x 2 ;ẋ 2 = x 3 and so on. The last equation is ẋ 3 = 1 2 {x 3 3x 2 6x 1 +4u}
Example... Introduction to State Variables State-Space Representations Output Equations The complete set of state equations is then: ẋ 1 = x 2 ẋ 2 = x 3 ẋ 3 = 1 2 {x 3 3x 2 6x 1 +4u}
Specifying Outputs Introduction to State Variables State-Space Representations Output Equations 1 The set of n state equations contains exactly the same information as the differential equation 2 It is frequently useful to define outputs of interest (other than x itself) to reflect variables being measured or monitored 3 A linear output is a combination of state variables and input: y = c 1 x 1 +c 2 x 2 +...c n x n +du
Example Introduction to State Variables State-Space Representations Output Equations Find a state variable representation for the standard 1 DOF mass-spring-damper system. Find output equations for the velocity and the acceleration of the block, and also for the force in the damper.
Simulating with ode45 1 Multi-DOF, nonlinear vibratory systems can be efficiently simulated in Matlab by using a state-variable based solver instead of Simulink 2 ode45 uses Runge-Kutta s 4-5 integration method and will suit our needs in this course. 3 A function must be written that returns the vector of state derivatives given t, x and u. 4 The function contains the state equations written in Matlab language. 5 Once the function has been written, ode45 can be used from the command line or from other programs
ode45 format function xdot=example(t,x,u) xdot1=x(2); xdot2=x(3);... xdotn=%enter the expression here xdot=[xdot1;xdot2;...xdotn]; %return derivative vector Note: function must be saved using the function name (example) and extension m. (example.m). Test that the function works by calling it from the workspace: >>example(0,[0;0;0..0];0)
Example Introduction to State Variables The function for the previous example must be something like: function xdot=example(t,x,u) u=sin(t) %sinusoidal input xdot1=x(2); xdot2=x(3);... xdot3=(x(3)-3*x(2)-6*x(1)+4*u)/2 xdot=[xdot1;xdot2;...xdotn];
Example... Introduction to State Variables The call to ode45 requires: 1 A time span [0 tend] 2 A vector of n initial conditions x0 Example: x(0) = 1, ẋ(0) = 0, ẍ(0) = 1, simulate from 0 to 10 sec: >> x0=[1;0;-1]; >> tspan=[0 10]; >> [t,x]=ode45( example,tspan,x0); >> plot(t,x(:,1)) %plot 1st state
Standard Linear State-Space Form Standard form: ẋ = Ax +Bu and y = Cx +Du The column vector x = [x 1,x 2,...x n ] T is called the state vector The set where x varies is the state space The column vector u = [u 1,u 2...u m ] T is the input vector The column vector y = [y 1,y 2,...y p ] T is the output vector For n states, m inputs, p outputs: A is an n-by-n matrix, B is n-by-m, C is p-by-n and D is p-by-m.
Example Introduction to State Variables Mass-spring-damper system. Choosing position and velocity as states, we find the following representation: [ ] [ ][ ] ] ẋ1 0 1 x1 0 = +[ 1 u ẋ 2 x 2 m For a velocity output: k b b m y = [0 1]x What are output matrices C and D for an acceleration output?
Recommended Exercise For the differential equation: 2 d4 x x dt 4 +0.9d3 +45.1ẍ +10ẋ +250x = 250u dt3 1 Sketch a computer simulation diagram 2 Simulate the response of the differential equation to a unit step input excitation. Set all initial conditions to zero. Plot x as a function of time and simulate for 1 second. 3 Find a state-variable representation. 4 Prepare a state derivative function for use with ode45. Simulate for 1 second. 5 Compare results. 6 Find matrices A, B, C and D of the state-space representation