CDS /: Lecture 3. Linear Systems Goals for Today: Revist and motivate linear time-invariant system models: Summarize properties, examples, and tools Convolution equation describing solution in response to an input Step response, impulse response Frequency response Characterize performance of linear systems Reading: Åström and Murray, FBS-2e, Ch 6.-6.3
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 2
Why are Linear Systems Important? 3
Why are Linear Systems Important? Many important examples Electronic circuits Especially true after feedback Frequency response is key performance specification 4
Why are Linear Systems Important? Many important examples 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 5
Solutions of Linear Time Invariant Systems: Modes 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 Matrix LTI system, with no input Let λλ ii and vv ii be eigenvalue/eigenvector of AA. Then: ee AAAA vv ii = II + tt! AA + tt2 2! AA2 + vv ii = vv ii + tt! λλ iivv ii + tt^2 2! λλ ii 2 vv ii + = ee λλiitt vv ii If n distinct eigenvalues, then xx = αα vv + αα 2 vv 2 + + αα nn vv nn, and ee AAAA xx = αα ee λλtt vv + αα 2 ee λλ2tt vv 2 + + αα nn ee λλnntt vv Sum of nn modes 6
Let HH tt The Convolution Integral: Step 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 ttnn HH tt tt nn+ = uu(tt tt nn+ tt nn )(tt nn+ tt nn ) nn nn= Taking the limit as tt nn+ tt nn yy tt = tt HH tt ττ uu ττ dddd 7
Impulse Response What is the impulse response due to u(t)=δ(t)? take limit as dt but keep unit area homogeneous u dt /dt t tt < uu tt = pp εε tt = /εε tt < εε tt εε δδ tt = lim εε pp εε (tt) Apply this unit impulse to the system (with x()=): yy tt = CCee AAAA BB
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 Convolution Theorem linear with respect to initial condition and input 2X input 2X output when x() = 9
MATLAB 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
MATLAB Tools for Phase Space System Equations xx = xx 2xx 2 xx 2 xx 2 xx 2 = xx xx 2 MATLAB CODE [x, x2]=meshgrid(-.5:.5:.5, -.5:.5:.5); xdot=-x - 2*x2*x^2 + x2; x2dot=-x-x2; quiver(x,x2,xdot,x2dot); x.6.4.2 -.2 -.4 -.6 -.6 -.4 -.2.2.4.6
MATLAB Tools for Phase Space function my_phases(ic) hold on [~,X]=ode45(@EOM,[,5],IC); u=x(:,); w=x(:,2); plot(u,w,'r'); xlabel('u') ylabel('w') grid end w.6.4.2 function dx=eom(t,x) dx=zeros(2,); x=x(); x2=x(2); xdot=-x - 2*x2*x^2 + x2; x2dot=-x-x2; dx=[xdot;x2dot]; end -.2 -.4 -.6 -.6 -.4 -.2.2.4.6 u 2
Input/Output Performance How does system respond to changes in input values? Transient response: Steady state response: Characterize response in terms of Impulse response Step response Frequency response Transient Steady State Mass spring system (L.2) Response to I.C.s, Transient response Response to inputs, Steady State (if constant inputs) 3
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.) 4
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 A u Gain = A y /A u Phase = 2π ΔT/T.5 A y 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 5 5 2 Time (sec.) ΔT T y 5
Computing Frequency Responses Technique #: plot input and output, measure relative amplitude and phase Generate response of system to sinusoidal output A u.5 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) 6
Calculating Frequency Response from convolution equation 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 7
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 8
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]. 9
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 2
Example: Inverted Pendulum on a Cart m f x M State: Input: u = F Output: y = x Linearize according to previous formula around = 22
Second Order Systems Many important examples: Response of st and 2 nd order systems -> 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π/ω y.2.8.6.4.2 ζ 5 5 2 25 Imag(λ).5 ζ> <ζ< time (sec) Analytical formulas exist for overshoot, rise time, settling time, etc Will study more next week -.5 - <ζ< -2 -.5 - -.5 Real(λ) 23
Second Order Systems Important class of systems in many applications areas y 2.8.6.4.2.8.6.4.2 T=2 / 5 5 2 25 time (sec) Analytical formulas exist for overshoot, rise time, settling time, etc Will study second order systems characteristics in more detail next week 24