MATLAB and its Control Toolbox

MATLAB and its Control Toolbox

02/09/20 MATLAB 1 02/09/20 MATLAB MATLAB and Toolboxes MATLAB and Control Control System Toolbox Simulink MATLAB Control Toolbox

2 Aerospace and Defense Automotive Biotech, Medical, and Pharmaceutical Chemical and Petroleum

Communications Computers and Office Equipment Education Electronics and Semiconductor Financial Services Industrial Equipment and Machinery Instrumentation Utilities and Energy 02/09/20 MATLAB Control Toolbox 3 The MathWorks Product Family

02/09/20 MATLAB Control Toolbox 4 MATLAB Math and optimization Signal Processing and communications Simulink Product Family Toolboxes Toolboxes Signal Processing

Communications Filter Design Filter Design HDL Coder Simulink Simulink Accelerator Simulink Report Generator Optimization Symbolic Math Partial Diff. Eq. 02/09/20 MATLAB Control Toolbox

.. Control System Design and Analysis Toolboxes Simulink Control Design Simulink Response Simulink Parameter 5 MATLAB-Toolboxes for Control Linear Control Nonlinear Control Control System Toolbox Simulink

Mu Toolbox Nonlinear Control Toolbox Fuzzy Toolbox Simulink 02/09/20 MATLAB Control Toolbox Identification Identification Toolbox Frequency-Domain ID Toolbox Simulink 6 Control Design Process

02/09/20 MATLAB Control Toolbox 7 Modeling Tools 02/09/20 MATLAB Control Toolbox 8 Design and Analysis

02/09/20 MATLAB Control Toolbox 9 Core Features Tools to manipulate LTI models Classical analysis and design

Bode, Nyquist, Nichols diagrams Step and impulse response Gain/phase margins Root locus design Modern state-space techniques 02/09/20 Pole placement LQG regulation MATLAB Control Toolbox 10 LTI Objects (Linear Time Invariant)

4 basic types of LTI models Transfer Function (TF) Zero-pole-gain model (ZPK) State-Space models (SS) Frequency response data model (FRD) Conversion between models Model properties (dynamics) 02/09/20

MATLAB Control Toolbox 11 Transfer Function p1 s n p 2 s n 1 ... p n 1 H (s ) m q1 s q1 s m 1 ... q m 1 where p1 , p 2 ... p n 1 numerator coefficients q1 , q1 ... q m 1 denominator coefficients 02/09/20 MATLAB Control Toolbox

12 Transfer Function Consider a linear time invariant (LTI) single-input/single-output system y '' 6 y ' 5 y 4u ' 3u 02/09/20 Applying Laplace Transform to both sides with zero initial conditions Y (s) 4s 3 G(s) 2 U ( s) s 6s 5 MATLAB Control Toolbox

13 Transfer Function >> num = [4 3]; >> den = [1 6 5]; >> sys = tf(num,den) Transfer function: 4s+3 ----------------s^2 + 6 s + 5 02/09/20 >> [num,den] = tfdata(sys,'v') num = 0 4 3 den = 1 6 5 MATLAB Control Toolbox

14 Zero-pole-gain model (ZPK) (s p1 )(s p 2 ) ... (s p n ) H (s ) K (s q1 )(s q 2 ) ... (s q m ) where p1 , p 2 ... p n 1 the zeros of H(s) q1 , q1 ... q m 1 the poles of H(s) 02/09/20 MATLAB Control Toolbox 15

Zero-pole-gain model (ZPK) Consider a Linear time invariant (LTI) single-input/ single-output system y '' 6 y ' 5 y 4u ' 3u Applying Laplace Transform to both sides with zero initial conditions Y (s) 4s 3 4( s 0.75) G(s) 2 U ( s ) s 6s 5 ( s 1)( s 5) 02/09/20

MATLAB Control Toolbox 16 Zero-pole-gain model (ZPK) >> sys1 = zpk(-0.75,[-1 -5],4) Zero/pole/gain: 4 (s+0.75) ----------(s+1) (s+5) 02/09/20 >> [ze,po,k] = zpkdata(sys1,'v') ze = -0.7500 po = -1 -5 k= 4

MATLAB Control Toolbox 17 State-Space Model (SS) . x A x B u y C x D u where x state vector u and y input and output vectors A , B ,C and D

state-space matrices 02/09/20 MATLAB Control Toolbox 18 Control System Toolbox Consider a Linear time invariant (LTI) single-input/single-output system y '' 6 y ' 5 y 4u '' 3u State-space model for this system is x1 ' 0 1 x1 0 x ' 5 6 x 1 u

2 2 x1 (0) 0 x (0) 0 2 x1 y 3 4 x2 02/09/20 MATLAB Control Toolbox 19 State-Space Models >> sys = ss([0 1; -5 -6],[0;1],[3,4],0) c= a=

x1 x2 x1 x2 y1 3 4 x1 0 1 x2 -5 -6 b= u1 x1 0 x2 1 02/09/20 d= u1 y1 0 MATLAB Control Toolbox 20

State Space Models rss, drss - Random stable state-space models. ss2ss - State coordinate transformation. canon - State-space canonical forms. ctrb - Controllability matrix. obsv - Observability matrix. gram - Controllability and observability gramians. ssbal - Diagonal balancing of state-space realizations. balreal - Gramian-based input/output balancing.

modred - Model state reduction. minreal - Minimal realization and pole/zero cancellation. sminreal - Structurally minimal realization. 02/09/20 MATLAB Control Toolbox 21 tf2ss State Space Transfer function ss2tf zp2tf ss2zp zp2ss

tf2zp Zero-pole-gain 02/09/20 MATLAB Control Toolbox 22

02/09/20 pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth - System bandwidth. iopzmap - Input/Output Pole-zero map. damp - Natural frequency and damping of system esort - Sort continuous poles by real part. dsort - Sort discrete poles by magnitude. covar - Covariance of response to white noise. MATLAB Control Toolbox 23 Control System Toolbox

02/09/20 Impulse Response (impulse) Step Response (step) General Time Response (lsim) Polynomial multiplication (conv) Polynomial division (deconv) Partial Fraction Expansion (residue) gensig - Generate input signal for lsim. MATLAB Control Toolbox 24 Control System Toolbox

The impulse response of a system is its output when the input is a unit impulse. The step response of a system is its output when the input is a unit step. The general response of a system to any input can be computed using the lsim command. 02/09/20 MATLAB Control Toolbox 25 Time Response of

Systems Problem Given the LTI system 3s 2 G( s ) 3 2 s 4s 2 5 s 1 Plot the following responses for: The impulse response using the impulse command. The step response using the step command. The response to the input u( t ) sin( 0.5 t ) calculated using both the lsim commands 02/09/20 MATLAB Control Toolbox 26 Time Response of Systems 02/09/20

MATLAB Control Toolbox 27 Root locus analysis Frequency response plots Bode Phase Margin Gain Margin 02/09/20 Nyquist

MATLAB Control Toolbox 28 Root Locus The root locus is a plot in the s-plane of all possible locations of the poles of a closed-loop system, as one parameter, usually the gain, is varied from 0 to . By examining that plot, the designer can make choices of values of the controllers parameters, and can infer the performance of the controlled closed-loop system. 02/09/20

MATLAB Control Toolbox 29 Root Locus Plot the root locus of the following system K ( s 8) G (s) s ( s 2)( s 2 8s 32) 02/09/20 MATLAB Control Toolbox 30

Root Locus >> rlocus(tf([1 8], conv(conv([1 0],[1 2]),[1 8 32]))) 02/09/20 MATLAB Control Toolbox 31 Frequency Response: Bode and Nyquist Plots Typically, the analysis and design of a control system requires an examination of its frequency response over a range of frequencies of interest. The MATLAB Control System Toolbox

provides functions to generate two of the most common frequency response plots: Bode Plot (bode command) and Nyquist Plot (nyquist command). 02/09/20 MATLAB Control Toolbox 32 Control System Toolbox Frequency Response: Bode Plot Problem Given the LTI system 1 G( s ) s( s 1) Draw the Bode diagram for 100 values of

10 1 10 frequency in the interval . 02/09/20 MATLAB Control Toolbox 33 Frequency Response: Bode Plot >>bode(tf(1, [1 1 0]), logspace(-1,1,100)); 02/09/20 MATLAB Control Toolbox 34 Frequency Response: Nyquist Plot

The loop gain Transfer function G(s) The gain margin is defined as the multiplicative amount that the magnitude of G(s) can be increased before the closed loop system goes unstable Phase margin is defined as the amount of additional phase lag that can be associated with G(s) before the closed-loop system goes unstable 02/09/20 MATLAB Control Toolbox 35 Control System Toolbox Frequency Response: Nyquist Plot

Problem Given the LTI system Draw the bode and nyquist plots for 100 values of frequencies in the interval 10 4 103. In addition, find the gain and phase margins. G( s ) 02/09/20 1280s 640 s 4 24.2 s 3 1604.81s 2 320.24s 16 MATLAB Control Toolbox 36 Frequency Response: Nyquist Plot w=logspace(-4,3,100); sys=tf([1280 640], [1 24.2 1604.81 320.24 16]);

bode(sys,w) [Gm,Pm,Wcg,Wcp]=margin(sys) %Nyquist plot figure nyquist(sys,w) 02/09/20 MATLAB Control Toolbox 37 Frequency Response: Nyquist Plot The values of gain and phase margin and corresponding frequencies are Gm = 29.8637 Pm = 72.8960 Wcg = 39.9099 Wcp = 0.9036 02/09/20 MATLAB Control Toolbox

38 Frequency Response Plots bode - Bode diagrams of the frequency response. bodemag - Bode magnitude diagram only. sigma - Singular value frequency plot. Nyquist - Nyquist plot. nichols - Nichols plot. margin - Gain and phase margins. allmargin - All crossover frequencies and related gain/phase margins. freqresp - Frequency response over a frequency grid. evalfr - Evaluate frequency response at given frequency. interp - Interpolates frequency response data. 02/09/20 MATLAB Control Toolbox 39

Design: Pole Placement place - MIMO pole placement. acker - SISO pole placement. estim - Form estimator given estimator gain. reg - Form regulator given state-feedback and estimator gains. 02/09/20 MATLAB Control Toolbox 40 Design : LQR/LQG design

lqr, dlqr - Linear-quadratic (LQ) state-feedback regulator. lqry - LQ regulator with output weighting. lqrd - Discrete LQ regulator for continuous plant. kalman - Kalman estimator. kalmd - Discrete Kalman estimator for continuous plant. lqgreg - Form LQG regulator given LQ gain and Kalman estimator. augstate - Augment output by appending states.

02/09/20 MATLAB Control Toolbox 41 Analysis Tool: ltiview File->Import to import system from Matlab workspace 02/09/20 MATLAB Control Toolbox 42 Control System Toolbox Design Tool: sisotool Design with root locus, Bode, and Nichols plots of the open-loop system.

Cannot handle continuous models with time delay. 02/09/20 MATLAB Control Toolbox 43 M-File Example %Define the transfer function of a plant G=tf([4 3],[1 6 5]) %find the bandwidth of the new system wb=bandwidth(T) %Get data from the transfer function [n,d]=tfdata(G,'v') %plot the step response step(T) [p,z,k]=zpkdata(G,'v')

%plot the rootlocus rlocus(T) [a,b,c,d]=ssdata(G) %Check the controllability and observability of the system ro=rank(obsv(a,c)) rc=rank(ctrb(a,b)) %obtain the bode plots bode(T) margin(T) %use the LTI viewer ltiview({'step';'bode';'nyquist'},T) %find the eigenvalues of the system damp(a) %multiply the transfer function with another transfer function T=series(G,zpk([-1],[-10 -2j +2j],5))

%start the SISO tool sisotool(T) %plot the poles and zeros of the new system iopzmap(T) 02/09/20 MATLAB Control Toolbox 44

Recently Viewed Presentations

  • Title Slide

    Title Slide

    Understanding Individuals with Traumatic Brain Injury. Presenter Information and/or Additional Information . Supported in part by ALH21MC06738 from the Department of Health and Human Services Health Resources and Services Administration, Maternal and Child Health Bureau.
  • Eighth Annual Meeting Critical Issues in the MCSD

    Eighth Annual Meeting Critical Issues in the MCSD

    Eighth Annual Meeting Critical Issues in the MCSD Evolution/Revolution May 5, 2014 7:00am to 3:15pm Crowne Plaza National Airport ... Red and Black 7_Red and Black 8_Red and Black 9_Red and Black 10_Red and Black 11_Red and Black 12_Red and...
  • Chapter Sixteen: Philosophy, Art, and Literature By Tommy

    Chapter Sixteen: Philosophy, Art, and Literature By Tommy

    Playwrights covered topics from histories glorifying their nation to epic tales of romance and valor. Plays, unlike art such as the opera and painting, was available to everyone, even the peasants. Actors were common, and so were plays, making theatre...
  • Copyright in Computer Software  a Primer Department of

    Copyright in Computer Software a Primer Department of

    Copyright in Computer Software - a Primer Department of Computer Science CMPT 370 - Intermediate Software Engineering September 10, 2010 Dr. Tom Roberts
  • Alternative Career Options - BU Blogs

    Alternative Career Options - BU Blogs

    Alternative Career Options DISCLAIMER The views reflected in this presentation are solely those of the presenter and do not necessarily reflect the position of my company, any of its clients, or any of my friends and colleagues that contributed to...
  • SER VS. ESTAR - WordPress.com

    SER VS. ESTAR - WordPress.com

    SER VS. ESTAR TO BE OR NOT TO BE? SER AND ESTAR ARE BOTH TO BE VERBS We have already learned that there are two "to be" verbs in Spanish. Here they are along with their conjugations. Please write them...
  • Distribuição de Recursos para Re-estruturação Acadêmica

    Distribuição de Recursos para Re-estruturação Acadêmica

    Gestão de Pessoas na Administração Pública Pró-Reitoria de Planejamento e Gestão Viçosa - 21 de maio de 2010 * * * * * * * * * * * * * Atribuições: Elaboração das normas complementares ao decreto Definição de...
  • IE6201: Manufacturing Systems Spring 2006

    IE6201: Manufacturing Systems Spring 2006

    Conditional Probability and Conditional Expectation and Applications The basic methodology Computing expectations and variances by conditioning Application to Compound random variables and other examples Course Outline Discrete Time Markov Chains Basic concepts Chapman-Kolmogorov equations State classification Limiting probabilities Examples ...