CDS /: Lecture 3. Linear Systems Goals for Today: Describe and motivate linear system models: Summarize properties, examples, and tools Joel Burdick (substituting for Richard Murray) jwb@robotics.caltech.edu, X439 Gates-Thomas 245 Convolution equation describing solution in response to an input Step response, impulse response Frequency response Characterize stability and performance of linear systems in terms of eigenvalues Reading: Åström and Murray, Analysis and Design of Feedback Systems, Ch 5 Homework: On course website Monday night
Quick Review: Stability and Performance Key topics Stability of equilibrium points Eigenvalues determine stability for linear systems Local versus global behavior CDS 4, 24 goes into much more detail 2
Linear Systems Recall: Linearity of Functions f: R nn R nn Addition: ff x + y = ff xx + ff(yy) Scaling: ff(α x) = α ff(x) Zero at the Origin: ff() = ff αx + βy = αff xx + βff(yy) Linear System: SS: uu tt xx tt If SS: uu tt xx tt ; SS: uu 2 tt xx 2 tt αxx tt + βxx 2 tt = SS αuu tt + βuu 2 tt Linear Control System: xx (tt) = AA xx tt + BB uu tt yy tt = CC xx tt + DD uu tt xx tt is system state ; uu tt are control inputs y tt is the system output, (what is observed) 3
Linear Systems u u 2 u + u 2 u - 5 y + + - 5 2-2 5 y 2 y + y 2 y - 5.5 -.5 5 2-2 5 Input/output linearity at x() = Linear systems are linear in initial condition and input need to use x() = to add outputs together For different initial conditions, you need to be more careful Linear system step response and frequency response scale with input amplitude 2X input 2X output Allows us to use ratios and percentages in step or frequency response. These are independent of input amplitude Limitation: input saturation only holds up to certain input amplitude 4
Why are Linear Systems Important? Many important examples Electronic circuits Especially true after feedback Frequency response is key performance specification 5
Why are Linear Systems Important? Many important examples Mechanical Systems q q 2 u(t) m m 2 k k 2 k 3 m c x f M 6
Why are Linear Systems Important? 7
Why are Linear Systems Important? Many important examples Electronic circuits Many important tools Frequency and step response, Traditional tools of control theory Developed in 93 s at Bell Labs Classical control design toolbox Nyquist plots, gain/phase margin Loop shaping CDS q 2 u(t) Optimal control and estimators Linear quadratic regulators Kalman estimators CDS 2 q k m m 2 k 2 k 3 c Robust control design H control design µ analysis for structured uncertainty CDS 22/ 23 8
Solutions of Linear Time Invariant Systems: The Matrix Exponential Linear Time Invariant (LTI) System: If Linear System input u(t) leads to output y(t) If u(t+t) leads to output y(t+t), the system is time invariant Scalar LTI system, with no input Matrix LTI system, with no input Matrix Exponential 9
The Matrix Exponential Recall scalar exponential formula: ee xx = + xx + xx2 + xx3! 2! 3! +, < xx < Matrix exponential defined analogously: ee MM = II +! MM + 2! MM2 + 3! MM3 + = Some useful properties of the Matrix Exponential If MM = mm mm nnnn, then ee MM = kk= kk! MMkk ee mm ee mm nnnn If matrix Y is invertible, then ee YYYYYY = YYee MM YY If M is diagonalizable (MM = TTTTTT ), then ee MM = TTee DD TT
The Convolution Integral: Step Let HH tt denote the response of a LTI system to a unit step input at t=. Assuming the system starts at Equilibrium The response to the steps are: First step input at time t=: HH tt tt uu tt Second step input at time tt : HH tt tt (uu tt uu tt ) Third step input at time tt 2 : HH tt tt 2 (uu tt 2 uu tt ) By linearity, we can add the response yy tt = HH tt tt uu tt + HH tt tt uu tt uu tt + = HH tt tt HH tt tt uu tt + HH tt tt HH tt tt 2 uu(tt ) + tt <tt = HH tt tt nn HH tt tt nn+ tt nn+ tt nn nn= Taking the limit as tt nn+ tt nn yy tt = HH tt uu(tt nn )(tt nn+ tt nn ) tt ττ uu ττ dddd
Impulse Response What is the impulse response due to u(t)=δ(t)? take limit as dt! but keep unit area u /dt homogeneous dt t Apply this unit impulse to the system (with x()=): Analogous to discrete-time response to input at time zero
Response to inputs: Convolution Impulse response, h(t) = Ce At B Response to input impulse Equivalent to Green s function homogeneous Linearity compose response to arbitrary u(t) using convolution Decompose input into sum of shifted impulse functions Compute impulse response for each Sum impulse response to find y(t) Take limit as dt Complete solution: use integral instead of sum linear with respect to initial condition and input 2X input 2X output when x() = 3
Matlab/Python Tools for Linear Systems A = [- ; -]; B = [; ]; C = [ ]; D = []; x = [;.5]; sys = ss(a,b,c,d); initial(sys, x); impulse(sys); t = :.:; u =.2*sin(5*t) + cos(2*t); lsim(sys, u, t, x); Amplitude Amplitude To: Y() To: Y().8.6.4.2 Initial Condition Results 2 3 4 5 6 7.5 Linear Simulation Results Other MATLAB commands gensig, square, sawtooth produce signals of diff. types step, impulse, initial, lsim time domain analysis bode, freqresp, evalfr frequency domain analysis -.5 2 3 4 5 6 7 8 9 Time (sec.) ltiview linear time invariant system plots 4
Input/Output Performance Return to system with inputs How does system response to changes in input values? Transient response: What happens right after a new input is applied Transient Steady State Steady state response: What happens a long time after the input is applied Stability vs input/output performance Systems that are close to instability typically exhibit poor input/output performance Nearly unstable systems (slow convergence) often exhibit ringing (highly oscillatory response to [non-periodic] inputs) Mass spring system (L2.) 5
Step Response Output characteristics in response to a step input Rise time: time required to move from 5% to 95% of final value Overshoot: ratio between amplitude of first peak and steady state value Settling time: time required to remain w/in p% (usually 2%) of final value Steady state value: final value at t =.5 Overshoot Amplitude.5 Rise time Settling time Steady state value 5 5 2 25 Time (sec.) 6
Second Order Systems Many important examples: Insight to response for higher orders (eigenvalues of A are either real or complex) Exception is non-diagonalizable A (non-trivial Jordan form) 2.8.6.4 T=2π/ω.2 y.8.6.4 ζ.2 5 5 2 25 time (sec) Analytical formulas exist for overshoot, rise time, settling time, etc Will study more next week 7
Stability of Linear Systems Q: when is the system asymptotically stable? Stability is determined by the eigenvalues of the matrix A Simple case: diagonal system Stable if λ ii Asy stable if λ ii < Unstable if λ ii > More generally: transform to Jordan form Asy stable if Re(λ ii ) < Unstable if Re(λ ii ) > Indeterminate if Re( i ) = Form of eigenvalues determines system behavior Linear systems are automatically globally stable or unstable 8
Eigenstructure of Linear Systems Real e-values Re(λ i ) < Real e-values Re(λ i ) < Re(λ i ) > Complex e-values Re(λ i ) = Complex e-values Re(λ i ) < 9
Frequency Response Measure steady state response of system to sinusoidal input Example: audio amplifier would like consistent ( flat ) amplification between 2 Hz & 2, Hz Individual sinusoids are good test signals for measuring performance in many systems Approach: plot input and output, measure relative amplitude and phase Use MATLAB or SIMULINK to generate response of system to sinusoidal output Gain = A y /A u Phase = 2π ΔT/T May not work for nonlinear systems System nonlinearities can cause harmonics to appear in the output Amplitude and phase may not be well-defined For linear systems, frequency response is always well defined Amplitude.5 u.5 -.5 - A u A y -.5 5 5 2 Time (sec.) ΔT T y 2
Computing Frequency Responses Technique #: plot input and output, measure relative amplitude and phase Generate response of system to sinusoidal output.5 u A u y Gain = A y /A u Phase = 2π ΔT/T For linear system, gain and phase don t depend on the input amplitude.5 -.5 - A y ΔT T Technique #2 (linear systems): use bode (or freqresp) command Assumes linear dynamics in state space form: Gain plotted on log-log scale db = 2 log (gain) Phase plotted on linear-log scale Phase (deg) Magnitude (db) -.5 5 5 2 2 - -2-3 -4-5 -6-9 -8-27 bode(ss(a,b,c,d)) -36. Frequency (rad/sec) 2
Calculating Frequency Response from convolution equation (more later) Convolution equation describes response to any input; use this to look at response to sinusoidal input: u(t) Transient (decays if stable) Ratio of response/input Frequency response 22
q k q 2 u(t) m m 2 k 2 Spring Mass System k 3 c Eigenvalues of A: Frequency response: C(jωI-A) - B+D For zero damping, jω and jω 2 ω and ω 2 correspond frequency response peaks The eigenvectors for these eigenvalues give the mode shape: In-phase motion for lower freq. Out-of phase motion for higher freq. Frequency Response Phase [deg] Gain (log scale)... -9-8 -27-36 Frequency [rad/sec]. 23
Summary: Linear Systems u y + - 5-5 2-2 5 + - 5.5 -.5 5 2-2 5 Properties of linear systems Linearity with respect to initial condition and inputs Stability characterized by eigenvalues Many applications and tools available Provide local description for nonlinear systems 24
Linearization Around an Equilibrium Point 2 Linearize around x=x e x 2-2 -2 2 x Remarks In examples, this is often equivalent to small angle approximations, etc Only works near to equilibrium point Full nonlinear model Linear model (honest!) 25
Example: Inverted Pendulum on a Cart m f x M State: Input: u = F Output: y = x Linearize according to previous formula around = 27