56
Control Systems Control Engineering with MATLAB [email protected]

Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

  • Upload
    others

  • View
    36

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control Systems

Control Engineering

with MATLAB

[email protected]

Page 2: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Oultine

MATLAB introduction

MATLAB basics

MATLAB/Control systems toolbox

Page 3: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

MATLAB

Cleve Moler (mathematician, C.S. Professor, co-author of

LINPACK), started developing MATLAB in the late 70s to

give students easy access to LINPACK(Numerical Library)

MATLAB ("Matrix Laboratory")became popular

• interactive

• easy input, output

• operations on a whole vector or matrix at once

Jack Little saw MATLAB in a lecture by Cleve Moler at

Stanford University and founded The Mathworks

• rewrote MATLAB in C

• added "M-files" (stored programs)

• many new features and libraries

Page 4: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

MATLAB

FORTRAN Compiler

Linear Algebra Libraries

MATLAB

MATLAB "Toolboxes"MATLAB "M-Files"

Standard base platform

Modular, reusable software components

Extensible using Toolboxes or user-contributed programs called M-files.

Interactive user interface; hides boring details

Page 5: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Matlab Today

A standard tool in both professional and academic use

"Toolboxes" providing functions for many applications:

• control systems

• identification

• neural networks

• bio-informatics

• statistics and time-series analysis

• …

Symbolic mathematics (symbolic toolboxe, mupad)

Simulink: GUI based simulation tool

Page 6: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

MATLAB Toolboxes

MATLAB

Math andoptimization

Toolboxes

Optimization Symbolic Math Partial Diff. Eq.…

Signal Processingand communications

ToolboxesSignal Processing Communications Filter Design Filter Design HDL Coder …

SimulinkProduct Family

Simulink®

Simulink Accelerator

Simulink Report

Generator

….. Control System Design and Analysis

Toolboxes

Simulink Control DesignSimulink ResponseSimulink Parameter …

Page 7: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

MATLAB and Control

MATLAB-Toolboxes for Control

Linear Control

Control System ToolboxSimulink®Mu Toolbox

Nonlinear Control

Nonlinear Control ToolboxFuzzy ToolboxSimulink®

Identification

Identification ToolboxFrequency-Domain ID ToolboxSimulink®

Page 8: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

MATLAB Environment

그림창그래프 명령어가실행되면 자동 생성됨

Toolbar

Workspace Window사용된 변수들에대한 정보 제공

Command History Window명령어 창에서 입력된명령어들이 기록되어 있음

Editor Window프로그램 작성 및 편집

Page 9: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

MATLAB Help Windows

Page 10: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Command Window

명령어와 명령어 사이에 콤마(,)를 넣어

여 러 명 령 어 를 한 줄 에 표 시 가

가능하다.

Enter 키를 누르면 명령어를 수행한다.

위쪽 방향키(↑)를 누를 때마다 이전에

입력했던 명령어가 역순으로 나타난다.

명령어가 길어서 한 줄에 쓸 수 없는

경우, 마침표 세 개 ...을 찍고 Enter 키를

누르면 다음 줄에서 이어서 쓸 수 있다

기호 (%)를 명령어 줄 제일 앞에 쓰면

주석문(comment)으로 지정된다.

c l c 는 명 령 어 창 에 서 입 력 한

명령어들과 결과 출력물들을 지워서

명령어 창을 깨끗이 만든다.

명령어 끝에 세미콜론 ( ; )을 붙이면

출력이 표시되지 않는다.

Page 11: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

MATLAB m 파일의 생성

MATLAB 메뉴의 File→New→M-File을 선택하거나, 메뉴

밑의 Toolbar에서 아이콘 을 선택하면, Editor 창이 실행

된다. 이 Editor 창에서 프로그램을 작성하고 예를 들어

test.m으로 저장을 한 후, 매트랩 명령어 창에서 >> test

라고 입력하면 프로그램이 수행된다.

Page 12: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

행렬의 입력방법

• 직각 수치 행렬을 기본적인 자료의 형식으로 취급

• 차원의 선언이나 형 선언이 불필요, 컴퓨터가 자동적으로 저장공간

을 할당

• 행렬의 원소 : 실수, 복소수, 문자

• 행렬 입력 방식

명령창

내부명령 또는 함수들을 사용하여 행렬을 생성

M-파일 내에서 행렬을 구성

외부의 자료 파일로부터 행렬을 불러들임

• 행렬입력의 규칙

원소들은 빈칸 또는 쉼표를 사용하여 분리한다.

전체 원소들은 대괄호( [ ] )로 감싼다.

원소의 끝에 세미콜론( ; )을 붙이면 한 행의 종료를 의미한다.

Page 13: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

행렬의 덧셈과 뺄셈

• ‘+’와 ‘-’ 기호 사용

• 두 행렬 또는 벡터의 차원이 같아야 함

• 각 행렬의 같은 위치, 즉 행렬 상의 색인이 같은 원소끼리 연산

• 예외적으로 1×1 행렬인 스칼라의 경우에는 어떤 한 행렬이나 벡터와도 연산이 가능, 행렬이나 벡터의 모든 원소들에 스칼라를 더하거나 빼면 됨

>> A=[1 2 3; 4 5 6];

>> B=[2 4 6; 1 3 5];

>> C=A+B

C =

3 6 9

5 8 11

>> C-5

ans =

-2 1 4

0 3 6

Page 14: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

행렬의 곱셈과 나눗셈

행렬의 곱셈

• ‘*’ 기호 사용

• 두 행렬 또는 벡터의 내부 차원(inner dimension)이 일치해야 함

행렬의 나눗셈

• 스칼라와는 달리 일반적으로 좌측 나누기와 우측 나누기의 결과가 일치하지 않음

• 좌측 나누기 : X=A\B -----> A*X=B의 해 (X = inv(A)*B)

>> X=A\B

X =

0.2000 0.1000

0.6000 2.3000

>> inv(A)*B

ans =

0.2000 0.1000

0.6000 2.3000

Page 15: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

행렬의 곱셈과 나눗셈

• 우측 나누기 : X=A/B ----> X*B=A 해 (X = A*inv(B))

>> X1=A/B

X1 =

0.2500 0.2500

-4.0000 6.0000

>> A*inv(B)

ans =

0.2500 0.2500

-4.0000 6.0000

Page 16: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

행렬 성분의 연산

• 행렬의 성분 하나하나를 각각 연산 하고 싶을 때

• 계산 기호 앞에 ‘.’ 을 찍어주면 된다.

>> A = [1 2 3; 4 5 6; 7 8 9]

A =

1 2 3

4 5 6

7 8 9

>> A*Aans =

30 36 4266 81 96102 126 150

>> A.*Aans =

1 4 916 25 3649 64 81

Page 17: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

벡터

벡터의생성

• ‘시작값:증가분:최종값’ 형식으로 지정 행벡터 생성

• ‘시작값:최종값’ 형태로 입력하면 증가분은 자동적으로 1이 됨

>> x=1:5

x =

1 2 3 4 5

>> y=0:0.5:3

y =

0 0.5000 1.0000 1.5000 2.0000 2.5000 3.0000

>> z=5:-1:-5

z =

5 4 3 2 1 0 -1 -2 -3 -4 -5

• 열벡터는 행벡터로 부터 작은따옴표를 사용하여 생성

Page 18: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

M-file

When writing a program in MATLAB, save it as m-file

( filename.m)

2 types of M-file

• 1- script (has no input and output, simply execute commands)

• 2- function (need input, starts with keyword “function”)

function [y z]=mfunc(x)y=(x*x')^.5; % norm of xz=sum(x)/length(x); % using 'sum' functionend

Page 19: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Polynomials

Present polynomial with coefficients vector

123 34 sss x = [1 3 0 -2 1];

P3=poly([-2 -5 -6]))6)(5)(2( sss

roots=roots(P3)6,5,2

)5)(2( ss P5=conv([1 2],[1 5])

Poly converts roots to coefficients of a polynomial:

Page 20: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

-3 -2 -1 0 1 2 3 4 5 6-40

-30

-20

-10

0

10

20

30

40

› p=poly([-2 1 5])

› R=roots(p)

› x=-3:0.1:6;

› y=p(1)*x.^3+p(2)*x.^2+p(3)*x+p(4);

› plot(x,y)

› grid

p =

1 -4 -7 10

R =

5.0000

-2.0000

1.0000

Polynomials

Page 21: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Symbolic computation in MATLAB

Syms s t %defines s and t as symbolic variable

› syms s a t

› G4=laplace(exp(t)) G4 =1/(s - 1)

› G5=laplace(exp(-t)) G5 =1/(s + 1)

› G6=laplace(sin(a*t)) G6 =a/(a^2 + s^2)

ilaplace(F,s,t): computes Inverse Laplace transform of F on the

complex variable s and returns it as a function of the time, t.

› ilaplace(a/(s^2+a^2),s,t)=(a*sin(t*(a^2)^(1/2)))/(a^2)^(1/2)

Page 22: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

› A=[1,1;0,1];

› syms t;

› Q=expm(A*t) %computes the matrix exponential of M.

› G=laplace(Q,t,s):

G =

[ 1/(s - 1), 1/(s - 1)^2]

[ 0, 1/(s - 1)]

Symbolic computation in MATLAB

Page 23: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

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

• Pole placement

• LQG regulation

Page 24: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

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)

Page 25: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

1

1 2 1

1

1 1 1

1 2 1

1 1 1

...( )

...

, ... numerator coefficients

, ... denominator coefficients

n n

n

m m

m

n

m

p s p s pH s

q s q s q

where

p p p

q q q

Transfer Function

Page 26: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

'' 6 ' 5 4 ' 3y y y u u

• Consider a linear time invariant (LTI) single-input/single-output system

• Applying Laplace Transform to both sides with zero initial conditions

2

( ) 4 3( )

( ) 6 5

Y s sG s

U s s s

Transfer Function

Page 27: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

>> num = [4 3];

>> den = [1 6 5];

>> sys = tf(num,den)

Transfer function:

4 s + 3

-----------------

s^2 + 6 s + 5

Transfer Function

>> [num,den] = tfdata(sys,'v')

num = 0 4 3

den =1 6 5

Page 28: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

Zero-pole-gain model (ZPK)

1 2

1 2

1 2 1

1 1 1

( )( ) ... ( )( )

( )( ) ... ( )

, ... the zeros of H(s)

, ... the poles of H(s)

n

m

n

m

s p s p s pH s K

s q s q s q

where

p p p

q q q

Page 29: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

'' 6 ' 5 4 ' 3y y y u u

Consider a Linear time invariant (LTI) single-input/single-output system

Applying Laplace Transform to both sides with zero initial conditions

2

( ) 4 3 4( 0.75)( )

( ) ( 1)( 5)6 5

Y s s sG s

U s s ss s

Zero-pole-gain model (ZPK)

Page 30: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

Zero-pole-gain model (ZPK)

>> sys1 = zpk(-0.75,[-1 -5],4)

Zero/pole/gain:4 (s+0.75)-----------(s+1) (s+5)

>> [ze,po,k] = zpkdata(sys1,'v')

ze =

-0.7500

po =

-1

-5

k =

4

Page 31: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

.

state vector

input and output vectors

, , state-space matrices

x A x B u

y C x D u

where

x

u and y

A B C and D

State-Space Model (SS)

Page 32: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

State-Space Models

'' 6 ' 5 4 '' 3y y y u u

Consider a Linear time invariant (LTI) single-input/single-output system

State-space model for this system is

1 1

2 2

' 0 1 0

' 5 6 1

x xu

x x

1

2

(0) 0

(0) 0

x

x

1

2

3 4x

yx

Page 33: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

>> sys = ss([0 1; -5 -6],[0;1],[3,4],0)

a =

x1 x2

x1 0 1

x2 -5 -6

b =

u1

x1 0

x2 1

c = x1 x2

y1 3 4

d = u1

y1 0

Page 34: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

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.

Page 35: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Conversion between different models

Transfer function State Space

Zero-pole-gain

tf2ss

ss2tf

tf2zpzp2tf ss2zp

zp2ss

Page 36: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Model Dynamics

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.

Page 37: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Time Response of Systems

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.

Page 38: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Time Response of Systems

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.

Page 39: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Problem Given the LTI system

Plot the following responses for:

The impulse response using the impulse command.

The step response using the step command.

The response to the input calculated usingboth the lsim commands

Control System Toolbox

1s5s4s2

2s3)s(G

23

)t5.0sin()t(u

Page 40: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

Time Response of Systems

Page 41: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Frequency Domain Analysis and Design

Root locus analysis

Frequency response plots• Bode

Phase Margin

Gain Margin

• Nyquist

Page 42: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Frequency Domain Analysis and Design

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 controller’s parameters, and can infer the performance of the controlled closed-loop system.

Page 43: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Plot the root locus of the following system

2

( 8)( )

( 2)( 8 32)

K sG s

s s s s

Root Locus

Frequency Domain Analysis and Design

>> rlocus(tf([1 8], conv(conv([1 0],[1 2]),[1 8 32])))

Page 44: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

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).

Page 45: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Frequency Response: Bode Plot

Problem

Given the LTI system

Draw the Bode diagram for 100 values of frequency in the

interval .

1G(s )

s(s 1)

110 10

Page 46: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

>>bode(tf(1, [1 1 0]), logspace(-1,1,100));

Page 47: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

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

Page 48: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Problem

Given the LTI system

Draw the bode and nyquist plots for 100 values of frequencies in the interval . In addition, find the gain and phase margins.

16s24.320s81.1604s2.24s

640s1280)s(G

234

4 310 10

Frequency Response: Nyquist Plot

Page 49: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

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)

Page 50: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

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

Page 51: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

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.

Page 52: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

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.

Page 53: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

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.

Page 54: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

Control System Toolbox

Analysis Tool: ltiview

File->Import to import system from MATLAB workspace

Page 55: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

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.

Page 56: Control Systems - chibum.files.wordpress.com · pzmap: Pole-zero map of LTI models. pole, eig - System poles zero - System (transmission) zeros. dcgain: DC gain of LTI models. bandwidth

Control SystemsChibum Lee -Seoultech

M-File Example%Define the transfer function of a plant

G=tf([4 3],[1 6 5])

%Get data from the transfer function

[n,d]=tfdata(G,'v')

[p,z,k]=zpkdata(G,'v')

[a,b,c,d]=ssdata(G)

%Check the controllability and observability of the system

ro=rank(obsv(a,c))

rc=rank(ctrb(a,b))

%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))

%plot the poles and zeros of the new system

iopzmap(T)

%find the bandwidth of the new systemwb=bandwidth(T)

%plot the step responsestep(T)

%plot the rootlocusrlocus(T)

%obtain the bode plotsbode(T)margin(T)

%use the LTI viewerltiview({'step';'bode';'nyquist'},T)

%start the SISO toolsisotool(T)