State Space Models312

download State Space Models312

of 19

Transcript of State Space Models312

  • 7/23/2019 State Space Models312

    1/19

    STATE SPACE MODELS

    MATLAB Tutorial

  • 7/23/2019 State Space Models312

    2/19

    Why State Space Models

    The state space model represents a physical

    system as nfirst order differentialequations. This form is better suited for

    computer simulation than an nthorder input-

    output differential equation.

  • 7/23/2019 State Space Models312

    3/19

    Basics

    Vector matrix format generally is given by

    !here yis the output equation" and xis the state vector

  • 7/23/2019 State Space Models312

    4/19

    PARTS OF A STATE SPACE

    REPRESENTATION

    State Vaia!les a subset of system variables !hich

    if #no!n at an initial time t$along !ith subsequent

    inputs are determined for all time t%t$&

    State E"#atio$s n linearly independent first order

    differential equations relating the first derivatives of

    the state variables to functions of the state variables

    and the inputs.

    O#tp#t e"#atio$s algebraic equations relating the

    state variables to the system outputs.

  • 7/23/2019 State Space Models312

    5/19

    E%AMPLE

    The equation gathered from the free body diagram is

    mx"& bx'& kx- f't( ) $

    *ubstituting the definitions of the states into the

    equation results in

    mv'& bv& kx- f't( ) $

    *olving forv' gives the state equation

    v') '-b/m)v& '-k/m)x & f't(+m

    The desired output is for the position"x" so

    y)x

  • 7/23/2019 State Space Models312

    6/19

    Co$t&

    ,o! the derivatives of the state variables are

    in terms of the state variables" the inputs"and constants.

    x' = v

    v'' ()k/m*x + ()b/m* v+ f(t*,m

    y)x

  • 7/23/2019 State Space Models312

    7/19

    P-TTIN. INTO VECTOR)MATRI%

    FORM

    ur state vector consists of t!o variables"x

    and vso our vector-matrix !ill be in the form

  • 7/23/2019 State Space Models312

    8/19

    Expla$atio$

    The first ro! of Aand the first ro! of Bare

    the coefficients of the first state equation forx'. Li#e!ise the second ro! of Aand the

    second ro! of Bare the coefficients of the

    second state equation for v'. Cand Dare the

    coefficients of the output equation for y.

  • 7/23/2019 State Space Models312

    9/19

    E%ACT REPRESENTATION

  • 7/23/2019 State Space Models312

    10/19

    /OW TO INP-T T/E STATE

    SPACE MODEL INTO MATLAB

    n order to enter a state space model into MATLAB"

    enter the coefficient matrices A" B" C" and Dinto

    MATLAB. The syntax for defining a state space

    model in MATLAB is

    statespace ) ss'A" B" /" 0(

    !here A" B" C" and Dare from the standard vector-

    matrix form of a state space model.

  • 7/23/2019 State Space Models312

    11/19

    Exa0ple

    1or the sa#e of example" lets ta#e m ) 2" b ) 3" and # ) 4.

    %% m ) 25

    %% b ) 35

    %% # ) 45

    %% A ) 6 $ 7 5 -#+m -b+m 85

    %% B ) 6 $ 5 7+m 85

    %% / ) 6 7 $ 85 %% 0 ) $5

    %% statespace9ss ) ss'A" B" /" 0(

  • 7/23/2019 State Space Models312

    12/19

    O#tp#t

    This assigns the state space model under

    the name statespace9ss and output thefollo!ing

    a =

    x1 x2

    x1 0 1 x2 -1.5 -2.5

  • 7/23/2019 State Space Models312

    13/19

    Co$t&

    b =

    u1

    x1 0 x2 0.5

    c =

    x1 x2

    y1 1 0

  • 7/23/2019 State Space Models312

    14/19

    Co$t&

    d =

    u1 y1 0

    Continuous-time mode.

  • 7/23/2019 State Space Models312

    15/19

    E%TRACTIN. A1 B1 C1 DMATRICES FROM A STATE SPACEMODEL n order to extract the A" B" /" and 0

    matrices from a previously defined statespace model" use MATLAB:s ssdata

    command.

    6A" B" /" 08 ) ssdata'statespace(

    !here statespace is the name of the statespace system.

  • 7/23/2019 State Space Models312

    16/19

    Exa0ple

    %% 6A" B" /" 08 ) ssdata'statespace9ss(

    The MATLAB output !ill be! =

    -2.5000 -0.#50 $.0000 0

  • 7/23/2019 State Space Models312

    17/19

    Co$t&

    % =

    0.2500 0

    C =

    0 0.5000

    & =

    0

  • 7/23/2019 State Space Models312

    18/19

    STEP RESPONSE -SIN. T/E

    STATE SPACE MODEL

    nce the state space model is entered into MATLAB it is easy

    to calculate the response to a step input. To calculate the

    response to a unit step input" use step'statespace(

    !here statespace is the name of the state space system.

    1or steps !ith magnitude other than one" calculate the step

    response using

    step'u ; statespace(

    !here u is the magnitude of the step and statespace is the

    name of the state space system.

  • 7/23/2019 State Space Models312

    19/19