Transcription of State Space Models - Stanford University
1 MUS420 Introduction to Linear State Space ModelsJulius O. Smith III for Computer Research in Music and Acoustics (CCRMA)Department of Music, Stanford UniversityStanford, California 94305 February 5, 2019 Outline State Space Models Linear State Space Formulation Markov Parameters (Impulse Response) Transfer Function Difference Equations to State Space Models Similarity Transformations Modal Representation (Diagonalization) Matlab Examples1 State Space ModelsEquations of motionfor any physical system may beconveniently formulated in terms of itsstatex(t):ftInput Forcesu(t)RModel Statex(t) x(t) x(t) =ft[x(t), u(t)]wherex(t) =stateof the system at timetu(t) =vector ofexternal inputs(typically driving forces)ft=general function mapping the current statex(t)andinputsu(t)to the State time-derivative x(t) The functionftmay be time-varying, in general This potentially nonlinear time-varying model isextremely general (but causal) Even thehuman braincan be modeled in this form2 State - Space History1.
2 Classicphase-spacein physics (Gibbs 1901)System State = point inposition-momentum space2. Digital computer (1950s)3. finite State Machines (Mealy and Moore, 1960s)4. finite Automata5. State - Space Models of Linear Systems6. Reference:Linear system theory: The State Zadeh and DesoerKrieger, 19793 Key Property of State VectorThe key property of the State vectorx(t)in the statespace formulation is that itcompletely determines thesystem at timet Future states depend only on the current statex(t)and on any inputsu(t)at timetand beyond All past states and the entire input history are summarized by the current statex(t) Statex(t)includes all memory of the system4 Force-Driven Mass ExampleConsiderf=mafor the force-driven mass.
3 Since the massmis constant, we can usemomentump(t) =m v(t)in place of velocity (more fundamental,since momentum isconserved) x(t0)andp(t0)(orv(t0)) define thestateof the massmat timet0 In the absence of external forcesf(t), all future statesarepredictablefrom the State at timet0:p(t) =p(t0)(conservation of momentum)x(t) =x(t0) +1mZtt0p( )d , t t0 External forcesf(t)drive the stateto arbitrary pointsin State Space :p(t) =p(t0) +Ztt0f( )d , t t0, p(t) =m v(t)x(t) =x(t0) +1mZtt0p( )d , t t05 Forming OutputsAny systemoutputis some function of the State , andpossibly the input (directly):y(t) =ot[x(t), u(t)]ftInput Forcesu(t)RModel Statex(t) x(t)y(t)otUsually the output is alinear combinationof statevariables and possibly the current input:y(t) =Cx(t) +Du(t)whereCandDare constant matrices oflinear-combination coefficients6 Numerical IntegrationRecall the general State - Space model in continuous time.
4 X(t) =ft[x(t), u(t)]An approximate discrete-time numerical solution isx(tn+Tn) =x(tn) +Tnftn[x(tn), u(tn)]forn= 0,1,2, ..(Forward Euler)Letgtn[x(tn), u(tn)] =x(tn) +Tnftn[x(tn), u(tn)]:u(tn)x(tn)gtx(tn+Tn)z Tn This is a simple example ofnumerical integrationforsolving the ODE ODE can be nonlinear and/or time-varying The sampling intervalTnmay be fixed or adaptive7 State DefinitionWe need astate variablefor the amplitude of eachphysical degree of freedomExamples: Ideal Mass:Energy=12mv2 State variable=v(t)Note that in 3D we get three State variables(vx, vy, vz) Ideal Spring:Energy=12kx2 State variable=x(t) Inductor: Analogous to mass, socurrent Capacitor.
5 Analogous to spring, socharge(or voltage = charge/capacitance) Resistors and dashpots need no State variablesassigned they arestateless(no memory )8 State - Space model of a Force-Driven MassFor the simple example of a massmdriven by externalforcefalong thexaxis:f(t)x= 0v(t)m There is only one energy-storage element (the mass),and it stores energy in the form ofkinetic energy Therefore, we should choose the State variable to bevelocityv= x(or momentump=mv=m x) Newton sf=mareadily gives the State -spaceformulation: v=1mfor p=f This is a first-order system (no vector needed)9 Force-Driven Mass ReconsideredWhy not includepositionx(t)as well as velocityv(t)inthe State - Space model for the force-driven mass?
6 X(t) v(t) = 0 10 0 x(t)v(t) + 01/m f(t)We might expect this because we know from before thatthe complete physical State of a mass consists of itsvelocityvandpositionx!10 Force-Driven Mass Reconsidered and Dismissed Positionxdoes not affect stored energyEm=12m v2 Velocityv(t)is the onlyenergy-storing degree offreedom Only velocityv(t)is needed as a State variable The initial positionx(0)can be kept on the side toenable computation of the complete State inposition-momentum Space :x(t) =x(0) +Zt0v( )d In other words, the position can be derived from thevelocity history without knowing the force history Note that the external forcef(t)can only drive v(t).
7 It cannot drive x(t)directly: x(t) v(t) = 0 10 0 x(t)v(t) + 01/m f(t)11 State Variable Summary State variable =physical amplitudefor someenergy-storing degree of freedom Mechanical Systems: State variable for each ideal spring(linear or rotational) point mass(or moment of inertia)times the number of dimensions in which it can move RLC Electric Circuits: State variable for eachcapacitorandinductor In Discrete-Time: State variable for eachunit-sample delay Continuous- or Discrete-Time:Dimensionality of State - Space =orderof the system(LTI systems)12 Discrete-Time Linear State SpaceModelsFor linear, time-invariant systems, a discrete-timestate- Space modellooks like avector first-orderfinite-differencemodel.
8 X(n+ 1) =Ax(n) +Bu(n)y(n) =Cx(n) +Du(n)where x(n) RN= State vectorat timen u(n) =p 1vector of inputs y(n) =q 1output vector A=N Nstate transition matrix B=N pinput coefficient matrix C=q Noutput coefficient matrix D=q pdirect path coefficient matrixThe State - Space representation is especially powerful for multi-input, multi-output(MIMO) linear systems time-varyinglinear systems(every matrix can have a time subscriptn)13 Zero- State Impulse Response(Markov Parameters)Linear State - Space model :y(n) =Cx(n) +Du(n)x(n+ 1) =Ax(n) +Bu(n)The zero-stateimpulse responseof a State - Space model iseasily found by direct calculation: Letx(0) = 0andu=Ip (n) =diag( (n).)
9 , (n)). Thenh(0) =Cx(0)B+D Ip (0) =Dx(1) =Ax(0) +B Ip (0) =Bh(1) =CBx(2) =Ax(1) +B (1) =ABh(2) =CABx(3) =Ax(1) +B (1) =A2Bh(3) = (n) =CAn 1B, n >014 Zero- State Impulse Response (MarkovParameters)Thus, the impulse response of the State - Space modelcan be summarized ash(n) =(D,n= 0 CAn 1B, n >0 Initial statex(0)assumed to be0 Input impulse isu=Ip (n) =diag( (n), .. , (n)) Each impulse-response sample h(n)is ap qmatrix, in general The impulse-response termsCAnBforn 0arecalledMarkov parameters15 Linear State - Space ModelTransfer Function Recall the linear State - Space model :y(n) =Cx(n) +Du(n)x(n+ 1) =Ax(n) +Bu(n)and its impulse response h(n) =(D,n= 0 CAn 1B, n >0 Thetransfer functionis theztransform of theimpulse response.)
10 H(z) = Xn=0h(n)z n=D+ Xn=1 CAn 1B z n=D+z 1C" Xn=0 z 1A n#BThe closed-form sum of a matrix geometric seriesgivesH(z) =D+C(zI A) 1B(ap qmatrixof rational polynomials inz)16 If there arepinputs andqoutputs, thenH(z)is ap qtransfer-function matrix(or matrix transfer function ) Given transfer-function coefficients, many digital filterrealizationsare possible (different computingstructures)Example: (p= 3,q= 2)H(z) = z 11 z 11 11 +z 12 + 3z 11 11 +z 11 z 1(1 z 1)2(1 1)(1 1) 17 System PolesAbove, we found the transfer function to beH(z) =D+C(zI A) 1 BThe poles ofH(z)are the same as those ofHp(z) = (zI A) 1 ByCramer s rulefor matrix inversion, the denominatorpolynomial for(zI A) 1is given by thedeterminant:d(z) =|zI A|where|Q|denotes thedeterminantof the square matrixQ(also written asdet(Q).)